sqlite-2.8.17/0000755000175000001440000000000010232547613013051 5ustar drhusers00000000000000sqlite-2.8.17/CVS/0000755000175000001440000000000010351570034013477 5ustar drhusers00000000000000sqlite-2.8.17/CVS/Tag0000644000175000001440000000001310232547612014133 0ustar drhusers00000000000000Tversion_2 sqlite-2.8.17/CVS/Root0000644000175000001440000000004410232547612014347 0ustar drhusers00000000000000:pserver:drh@www.sqlite.org:/sqlite sqlite-2.8.17/CVS/Repository0000644000175000001440000000000710232547612015602 0ustar drhusers00000000000000sqlite sqlite-2.8.17/CVS/Entries0000644000175000001440000000173110351570034015035 0ustar drhusers00000000000000D/art//// D/doc//// D/src//// D/test//// D/tool//// D/www//// /Makefile.in/1.87/Sat Apr 23 22:43:23 2005//Tversion_2 /Makefile.linux-gcc/1.1/Sat Apr 23 22:43:23 2005//Tversion_2 /README/1.6/Sat Apr 23 22:43:23 2005//Tversion_2 /aclocal.m4/1.3/Sat Apr 23 22:43:23 2005//Tversion_2 /config.guess/1.3/Sat Apr 23 22:43:23 2005//Tversion_2 /config.sub/1.3/Sat Apr 23 22:43:23 2005//Tversion_2 /configure/1.21/Sat Apr 23 22:43:23 2005//Tversion_2 /configure.ac/1.7/Sat Apr 23 22:43:23 2005//Tversion_2 /install-sh/1.1/Sat Apr 23 22:43:23 2005//Tversion_2 /ltmain.sh/1.3/Sat Apr 23 22:43:23 2005//Tversion_2 /main.mk/1.22.2.1/Sat Apr 23 22:43:23 2005//Tversion_2 /publish.sh/1.21.2.6/Sat Apr 23 22:43:23 2005//Tversion_2 /spec.template/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /sqlite.1/1.3/Sat Apr 23 22:43:23 2005//Tversion_2 /sqlite.def/1.2/Sat Apr 23 22:43:22 2005//Tversion_2 /sqlite.pc.in/1.1/Sat Apr 23 22:43:23 2005//Tversion_2 /VERSION/1.114.2.4/Mon Dec 19 17:38:14 2005//Tversion_2 sqlite-2.8.17/art/0000755000175000001440000000000010232547612013636 5ustar drhusers00000000000000sqlite-2.8.17/art/CVS/0000755000175000001440000000000010251061263014263 5ustar drhusers00000000000000sqlite-2.8.17/art/CVS/Tag0000644000175000001440000000001310232547612014721 0ustar drhusers00000000000000Tversion_2 sqlite-2.8.17/art/CVS/Root0000644000175000001440000000004410232547612015135 0ustar drhusers00000000000000:pserver:drh@www.sqlite.org:/sqlite sqlite-2.8.17/art/CVS/Repository0000644000175000001440000000001310232547612016365 0ustar drhusers00000000000000sqlite/art sqlite-2.8.17/art/CVS/Entries0000644000175000001440000000016210251061263015616 0ustar drhusers00000000000000/SQLite.eps/1.1/Sat Apr 23 22:43:22 2005/-kb/Tversion_2 /SQLite.gif/1.1/Sat Apr 23 22:43:22 2005/-kb/Tversion_2 D sqlite-2.8.17/art/SQLite.eps0000644000175000001440000005713310232547612015521 0ustar drhusers0000000000000034J*%!PS-Adobe-3.0 EPSF-3.0 %%Creator: Macromedia Flash 2.0 %%Title: (C:\Documents and Settings\mindplay\Desktop\SQLite.eps) %%CreationDate: (07/15/03) (04:12:33) %%DocumentData: Clean7Bit %%DocumentProcessColors: Cyan Magenta Yellow Black %%BoundingBox: 0 0 749 220 %%EndComments %%BeginProlog %%Copyright: Copyright 1995-97 Macromedia, Inc. All rights reserved. /bd {bind def} bind def /ld {load def} bd /xd {exch def} bd /G /setgray ld /R /setrgbcolor ld /_K {3 index add neg dup 0 lt {pop 0} if 3 1 roll} bd /K /setcmykcolor where {/setcmykcolor get} {{1 sub 4 1 roll _K _K _K setrgbcolor pop} bind} ifelse def /c /rcurveto ld /l /rlineto ld /M /moveto ld /cp /closepath ld /F {fill} bd /S {setlinewidth stroke} bd /IP {[] 0 setdash 1 setlinecap 1 setlinejoin} bd /TL /translate ld /CT /concat ld /GS /gsave ld /GR /grestore ld /B {M exch dup 0 rlineto exch 0 exch rlineto neg 0 rlineto} bd /CB {B cp eoclip newpath} bd /SSEncoding StandardEncoding 256 array copy def SSEncoding 39/quotesingle put SSEncoding 96/grave put /Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis/Udieresis/aacute /agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute/egrave /ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde/oacute /ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex/udieresis /dagger/degree/cent/sterling/section/bullet/paragraph/germandbls /registered/copyright/trademark/acute/dieresis/notequal/AE/Oslash /infinity/plusminus/lessequal/greaterequal/yen/mu/partialdiff/summation /product/pi/integral/ordfeminine/ordmasculine/Omega/ae/oslash /questiondown/exclamdown/logicalnot/radical/florin/approxequal/Delta/guillemotleft /guillemotright/ellipsis/space/Agrave/Atilde/Otilde/OE/oe /endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide/lozenge /ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright/fi/fl /daggerdbl/periodcentered/quotesinglbase/quotedblbase/perthousand /Acircumflex/Ecircumflex/Aacute/Edieresis/Egrave/Iacute/Icircumflex/Idieresis/Igrave /Oacute/Ocircumflex/apple/Ograve/Uacute/Ucircumflex/Ugrave/dotlessi/circumflex/tilde /macron/breve/dotaccent/ring/cedilla/hungarumlaut/ogonek/caron SSEncoding 128 128 getinterval astore pop /En {findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse } forall /Encoding SSEncoding def currentdict end definefont } bd /EN {1 index exch En def}bd /SF /setfont ld /FF /findfont ld /MFD {makefont def} bd /MFS {makefont setfont} bd /XT {/dis xd /str xd 0 1 str length 1 sub {/i xd currentpoint str i 1 getinterval show exch dis i get add exch moveto } for } bd /T /show ld %%EndProlog %%BeginSetup %%EndSetup [0.04998 0 0 -0.04998 -26 421] CT IP 15499 4317 M -9 -4 -17 -8 -26 -12 c -50 28 -73 77 -69 148 c 4 66 -19 120 -70 163 c -242 200 -519 348 -832 445 c -32 9 -62 20 -91 34 c -104 50 -209 100 -314 151 c -333 159 -630 362 -892 609 c -46 16 -86 38 -120 65 c 44 -9 88 -24 131 -44 c 11 3 22 7 33 11 c 164 -103 332 -203 503 -300 c 55 -33 110 -66 164 -100 c 370 -233 761 -424 1172 -574 c 295 -107 432 -306 411 -596 c cp 0 G F 14600 4222 M 189 -5 361 35 518 122 c -13 -11 -26 -21 -39 -32 c -56 -46 -116 -83 -181 -111 c -268 -117 -556 -163 -865 -140 c -27 4 -57 9 -90 16 c -117 25 -226 66 -327 124 c -47 26 -64 65 -51 116 c 12 11 23 15 33 13 c 323 -63 657 -99 1002 -108 c cp 0 G F 14714 4605 M -23 -5 -47 -9 -71 -10 c -10 6 -24 14 -41 23 c -118 65 -242 95 -373 91 c -28 11 -56 21 -84 30 c -36 11 -71 24 -104 40 c -165 79 -334 139 -509 181 c -17 18 -36 28 -57 29 c -63 4 -102 29 -117 75 c 13 45 50 60 109 45 c 36 -9 67 -27 93 -56 c 37 -7 73 -19 107 -36 c 339 -167 689 -303 1052 -406 c -1 -4 -3 -6 -5 -6 c cp 0 G F 13503 4670 M 100 -101 88 -184 -36 -249 c -279 16 -541 81 -786 195 c -132 62 -259 139 -381 230 c 1 5 4 9 7 13 c 7 5 16 10 25 14 c 66 -35 135 -66 207 -93 c 48 -19 95 -35 142 -50 c 203 -66 399 -106 589 -119 c -197 147 -394 296 -589 448 c -17 12 -33 24 -49 37 c -7 15 -10 32 -10 49 c 0 28 3 56 10 83 c 17 19 33 31 49 37 c 32 12 63 -2 93 -43 c 1 -11 4 -22 7 -33 c 7 -25 21 -47 42 -65 c 170 -75 323 -177 458 -306 c 83 -33 157 -83 222 -148 c cp 0 G F 13016 5353 M 78 -39 130 -82 156 -131 c -166 41 -330 90 -491 148 c -161 57 -319 123 -474 198 c -315 151 -623 315 -922 493 c -170 101 -337 207 -502 318 c -9 6 -19 12 -28 19 c -168 113 -332 232 -492 357 c -267 207 -523 424 -768 653 c -58 54 -116 109 -173 164 c -147 141 -291 285 -431 431 c 0 5 1 11 3 16 c 9 23 25 37 50 43 c 5 17 7 35 5 54 c -3 27 -4 55 -3 84 c -4 5 -8 10 -12 16 c -3 5 -7 10 -11 17 c -3 5 -7 10 -10 16 c 0 11 -1 21 -3 31 c -2 12 -4 23 -6 34 c -4 17 -3 33 3 49 c 95 74 197 73 304 -3 c 233 -165 445 -354 638 -569 c 29 -32 57 -65 84 -98 c 103 -121 210 -237 323 -347 c 169 -167 345 -326 527 -477 c 130 -108 264 -212 401 -311 c 33 -24 67 -48 101 -72 c 71 -50 142 -99 214 -148 c 346 -234 720 -415 1122 -543 c 3 -6 7 -11 12 -15 c 16 -13 32 -25 48 -36 c 49 -37 102 -69 158 -96 c -10 -3 -19 -1 -28 4 c -43 21 -87 40 -130 57 c -20 7 -40 13 -60 20 c -9 -4 -18 -8 -27 -11 c -271 83 -533 189 -784 320 c -179 93 -354 192 -525 298 c -171 106 -339 219 -502 339 c -116 85 -230 173 -342 266 c -270 221 -516 467 -737 737 c -32 39 -64 76 -97 113 c -155 172 -327 325 -515 458 c -14 -2 -28 -4 -42 -5 c -3 -11 -5 -22 -6 -33 c -1 -34 -1 -67 0 -99 c 2 -33 -2 -63 -13 -92 c 33 -21 63 -46 91 -75 c 66 -66 133 -131 200 -195 c 243 -233 499 -455 767 -664 c 86 -66 172 -131 258 -196 c 143 -108 289 -213 436 -314 c 43 -29 87 -58 130 -87 c 123 -83 247 -162 372 -237 c 58 -35 116 -70 175 -104 c 373 -215 752 -413 1138 -594 c 27 -13 55 -27 83 -40 c 113 -54 225 -108 335 -161 c cp 0 G F 13461 6166 M 56 -111 14 -172 -127 -183 c -173 -13 -347 -21 -521 -24 c -40 -3 -82 4 -125 21 c -3 1 -5 2 -7 4 c -2 2 -4 4 -5 7 c -12 13 -16 30 -12 49 c 2 14 8 26 17 35 c 4 4 8 8 13 11 c 9 5 20 10 31 14 c 28 -12 57 -17 88 -15 c 125 6 250 11 376 15 c -99 9 -195 26 -290 50 c -74 19 -147 41 -218 66 c -189 67 -367 157 -534 272 c -4 5 -7 10 -10 16 c -3 5 -5 10 -7 15 c -3 6 -7 12 -11 18 c -18 11 -37 20 -57 29 c -35 15 -58 39 -71 71 c -2 3 -1 8 3 14 c 7 0 13 -1 19 -4 c 38 -19 75 -40 111 -63 c 8 -5 16 -10 23 -15 c 113 -23 226 -59 338 -107 c 65 -28 130 -54 196 -79 c 253 -96 513 -168 780 -217 c cp 0 G F 8527 5730 M -101 21 -176 85 -224 190 c -62 131 -94 267 -96 408 c -1 53 3 106 10 161 c -33 21 -64 44 -94 68 c -9 7 -17 17 -24 28 c 0 21 0 43 0 64 c 0 10 0 21 0 32 c 0 10 0 21 0 32 c 69 55 137 108 206 158 c 297 218 641 244 1032 77 c 4 -7 8 -14 13 -21 c 5 -12 10 -23 13 -34 c 1 -11 0 -21 -5 -30 c -3 -12 -8 -21 -15 -26 c -14 -11 -30 -21 -49 -28 c -217 36 -433 22 -649 -42 c 276 -107 423 -299 442 -575 c 18 -271 -97 -424 -346 -459 c -63 -9 -135 -10 -214 -3 c cp 8741 6155 M 3 5 7 9 10 13 c 3 10 5 21 7 32 c 7 33 4 65 -7 96 c -3 4 -7 8 -10 11 c -7 7 -13 14 -18 21 c -24 29 -43 62 -57 97 c -57 59 -114 77 -171 53 c 0 -11 0 -22 0 -32 c 0 -39 0 -79 0 -118 c 0 -25 0 -49 0 -74 c 10 -12 19 -24 28 -35 c 27 -39 46 -81 57 -126 c 44 -34 83 -30 118 11 c 13 17 28 34 43 51 c cp 0 G F 8217 5741 M -7 -12 -14 -18 -21 -17 c -207 1 -411 -22 -610 -69 c -14 5 -28 11 -42 16 c 11 -67 23 -133 36 -198 c 26 -134 57 -266 92 -395 c -7 -11 -16 -21 -26 -30 c -53 -50 -115 -72 -188 -66 c 0 4 l -64 -1 -110 26 -139 81 c -23 135 -44 270 -62 406 c -12 91 -23 183 -32 274 c -23 3 -45 6 -68 9 c -70 8 -127 34 -171 79 c -38 37 -66 73 -84 109 c -33 66 -33 129 0 190 c 25 45 68 88 129 130 c 17 -7 33 -16 49 -27 c 43 -30 69 -71 79 -122 c 14 -12 28 -23 43 -32 c 5 -1 9 -1 14 -1 c 7 111 23 221 49 332 c 4 19 9 37 14 56 c 111 424 370 612 778 564 c 3 -12 5 -23 6 -34 c 3 -20 4 -41 4 -62 c -84 -95 -179 -180 -286 -257 c -104 -75 -180 -164 -228 -267 c -53 -113 -72 -241 -58 -386 c 111 -33 212 -82 305 -148 c 131 -15 263 -29 396 -43 c 7 -11 11 -23 12 -34 c 6 -20 9 -41 9 -62 c cp 0 G F 6560 5783 M 0 5 l -81 3 -135 40 -160 113 c 0 21 -1 43 -4 64 c -11 109 -12 216 -5 321 c 15 214 68 417 159 609 c 3 9 5 20 6 32 c 3 10 4 21 4 32 c 10 10 22 19 35 28 c 15 9 32 18 51 25 c 17 -7 33 -16 49 -27 c 10 -7 19 -16 26 -26 c 54 -111 79 -230 75 -355 c -4 -107 -7 -213 -9 -318 c 0 -11 0 -22 0 -32 c -3 -214 -78 -371 -227 -471 c cp 0 G F 6646 5377 M -5 -11 -9 -22 -13 -32 c -34 -65 -87 -101 -158 -107 c 0 5 l -66 -2 -112 25 -139 81 c -1 7 -2 14 -3 21 c -3 14 -4 28 -3 43 c 0 21 2 43 6 64 c 144 124 247 99 310 -75 c cp 0 G F 9684 6205 M 2 -7 5 -13 9 -18 c 95 -51 196 -90 305 -117 c 279 -73 537 -187 774 -341 c -27 36 -53 73 -77 110 c -77 115 -128 237 -151 364 c 27 41 64 54 113 38 c 4 -2 8 -3 12 -4 c 37 -72 75 -144 114 -215 c 55 -103 111 -204 168 -305 c 80 -143 32 -212 -145 -206 c 0 2 l -8 0 -16 1 -23 2 c -24 5 -42 20 -53 45 c -3 5 -6 10 -7 16 c -311 228 -660 379 -1047 453 c -41 1 -76 15 -103 40 c -4 4 -8 9 -11 15 c -8 43 -16 87 -23 130 c -9 49 -3 95 18 139 c 60 123 163 191 310 205 c 24 -8 43 -23 56 -46 c 3 -4 4 -9 4 -14 c -12 -15 -22 -31 -31 -48 c -32 -63 -85 -98 -159 -104 c -15 -17 -31 -33 -48 -46 c -5 -5 -10 -9 -13 -14 c 0 -6 0 -11 -1 -16 c -2 -23 1 -45 9 -65 c cp 0 G F 11602 5233 M -94 119 -178 243 -251 373 c -77 134 -52 213 75 237 c 101 -191 222 -372 362 -541 c 67 -80 148 -150 244 -209 c 145 -89 143 -161 -5 -215 c -273 83 -520 211 -742 386 c -47 37 -92 75 -136 116 c -7 5 -15 10 -23 14 c -32 16 -52 39 -59 68 c 7 3 15 7 22 11 c 65 -29 131 -58 196 -88 c 107 -49 212 -99 317 -152 c cp 0 G F 10091 6569 M -27 22 -57 41 -90 57 c -39 19 -59 47 -58 85 c 7 11 16 20 26 27 c 8 7 18 13 29 17 c 7 -3 14 -5 21 -8 c 9 -5 18 -10 28 -15 c 7 -3 15 -7 22 -10 c 12 3 25 7 38 10 c 103 13 172 -20 207 -98 c -2 -6 -4 -11 -6 -16 c -33 -67 -92 -87 -179 -60 c 0 1 0 2 -1 2 c -9 2 -18 4 -27 6 c -3 -1 -7 0 -10 3 c cp 0 G F 10527 7295 M -1 5 0 10 1 15 c 3 11 6 23 10 34 c 16 8 33 17 50 27 c 27 -9 54 -18 81 -27 c 3 -4 6 -8 9 -11 c 43 -47 78 -95 105 -144 c 3 -7 7 -13 11 -20 c -3 -6 -6 -10 -9 -13 c -1 -1 -1 -1 -2 -1 c -7 -5 -14 -10 -21 -13 c 0 2 l -106 3 -184 53 -235 151 c cp 0 G F 10950 7374 M 115 -47 226 -98 335 -152 c 26 -13 52 -26 77 -39 c 112 -57 226 -115 342 -174 c 311 -157 637 -267 977 -332 c 75 -15 152 -27 229 -36 c -3 -4 -5 -7 -8 -8 c -26 -9 -52 -15 -79 -20 c -36 -3 -73 -2 -110 1 c -11 1 -21 2 -32 3 c -72 5 -144 11 -215 18 c -71 7 -140 20 -209 39 c -227 63 -449 139 -666 228 c -103 43 -205 88 -306 136 c -157 74 -312 154 -463 241 c -3 5 -4 10 -5 16 c -1 10 -1 21 0 32 c 1 5 2 10 5 17 c 33 40 76 50 128 30 c cp 0 G F 2001 5734 M -46 -17 -94 -30 -143 -38 c -12 -3 -23 -6 -32 -9 c -26 -19 -52 -32 -79 -40 c -189 -59 -326 -127 -413 -206 c 249 -74 502 -109 759 -106 c 3 -12 3 -20 0 -24 c -123 -131 -287 -177 -492 -137 c -25 7 -49 10 -72 7 c -126 -15 -230 15 -312 89 c -43 10 -85 22 -126 37 c -31 11 -60 24 -88 38 c -12 7 -23 15 -32 22 c -19 31 -34 63 -47 98 c -9 19 -13 40 -13 62 c 0 9 2 20 6 32 c 207 94 428 158 663 192 c 57 53 119 95 188 126 c 113 51 214 123 304 216 c 3 31 8 63 17 94 c 35 125 -4 211 -118 257 c -401 165 -805 198 -1214 98 c -7 -11 -14 -23 -21 -34 c -12 -20 -22 -41 -30 -64 c -6 -10 -11 -20 -15 -30 c -6 -12 -12 -23 -19 -32 c -19 -12 -37 -23 -54 -32 c -19 10 -35 22 -49 36 c -7 7 -12 17 -15 28 c 5 45 19 90 41 133 c 18 35 42 67 72 94 c 10 8 19 18 26 29 c 0 10 0 21 0 33 c 0 9 0 20 0 32 c 0 9 0 20 0 32 c 451 336 947 362 1488 79 c 162 -87 254 -219 275 -394 c 39 -335 -86 -558 -374 -669 c -25 -21 -52 -38 -81 -49 c cp 0 G F 2836 6741 M 94 81 200 139 317 174 c 309 95 604 102 884 21 c 83 79 183 146 299 203 c 9 8 18 17 28 27 c 19 19 37 37 56 56 c 20 -4 39 -10 57 -19 c 6 -4 11 -10 15 -18 c -4 -10 -9 -18 -15 -24 c -24 -31 -49 -60 -76 -87 c -4 -9 -8 -18 -11 -26 c -36 -73 -76 -143 -121 -212 c 98 -66 169 -158 213 -276 c 121 -326 45 -579 -228 -758 c -56 -83 -123 -155 -201 -215 c -43 -35 -92 -58 -147 -70 c 12 -6 23 -13 33 -22 c 52 -38 88 -89 108 -154 c 3 -9 5 -17 6 -26 c -4 -29 -16 -54 -35 -75 c -103 -110 -242 -137 -415 -81 c -55 7 -111 23 -168 46 c -339 143 -591 374 -758 692 c -171 327 -118 608 159 844 c cp 2862 6122 M 8 -10 15 -20 22 -30 c 173 -287 422 -487 747 -602 c 70 -39 137 -39 202 0 c 6 14 11 29 16 45 c 4 9 8 18 12 28 c -5 18 -7 36 -7 55 c 0 9 2 18 7 28 c 19 30 40 60 62 89 c 51 72 107 143 167 213 c 7 71 29 136 67 196 c 56 90 70 190 43 299 c -17 18 -35 33 -54 44 c -30 17 -60 35 -90 52 c -4 -15 -6 -29 -7 -44 c -12 -188 -75 -331 -188 -428 c -113 29 -159 112 -138 249 c 19 124 55 237 106 338 c -361 67 -674 -9 -940 -229 c -10 -46 -17 -93 -20 -140 c -6 -54 -8 -108 -7 -163 c cp 0 G F 4948 5187 M -30 8 -59 18 -87 30 c -51 21 -84 57 -99 107 c -1 7 -2 14 -2 21 c -51 433 -68 871 -50 1313 c 13 357 221 484 624 380 c 168 -45 340 -67 517 -66 c 225 -2 376 -86 453 -253 c 0 -21 l -9 -19 -20 -34 -35 -44 c -305 -188 -630 -194 -975 -19 c -82 -5 -164 -10 -247 -13 c -15 -48 -20 -97 -15 -148 c 28 -323 62 -645 102 -965 c 11 -13 22 -27 34 -40 c 9 -11 17 -23 24 -36 c 5 -12 10 -24 15 -35 c 0 -13 -1 -26 -4 -38 c -1 -5 -3 -10 -4 -15 c -38 -112 -122 -165 -251 -158 c cp 0 G F 6308 6880 M -1 -4 -3 -8 -4 -11 c 0 21 l 1 -4 3 -7 4 -10 c cp 0 G F %%EOF  %  3:--$u:[:I:::&-:5$:H:[:p:::::::::::::999"949<9E9is9C9988888}8-c8;\8>V8BJ8J8d7~7777s7;7766a6J656$444B44:3Y3"32}2@I2j11]1)>18!1I1R1]'1T71OH1Kh1>111<&22!3Y33F44V^556m7'7?88n8b9W'9K39E99B@9@E9<K99W93\9/b9,n9&99 99999999:::(:t4:a>:LH:8P:"X: _:f:j:n:n:o:q:t:u:gu:Zv:Nu:4u:---$D6777{7778@8_888885888y8K838877}7jN7[7L6?64z6+C6" 655e5-54444!y4%a4* 4?3L3[3jg3}3 322222222 2"2#2%3&3'33w44q55p66---$Xd7:@737074 7:7@6G6]6a6c6d6f6pk6_6T6>665555+5444F4483P3Z3eG3y63}&33222222222v2b2O2@222'2222&2!*2%02*=22C23K25\27o25y23222-2)2#22 222222323?3M33M4^4&R55[66gi7@f7;d7:---$m2{2g2U2C222 2222222222221Q100-0/s/E/u.Q.-+-1-8.?.FG.+{...,/s/// 0S0wx0n0g0Y/1Nw1E1@0s/B/%:/<8/V8/j:/B/N/Z/f/l/s/u/v/x/~//////////o/^/N0A?0#]0|00000*1013171E1a1j{1S1=1&1112#212@2[2a2b2d2h2v222{---$0&000 00111#141E1R1X1^10f0/ s/7.c. .-"-5,p8,+*f))6)( (( '; o' & y&C & % ;%< $ y$ $/ # ]# #- T" y!!             E U \ f v v w y }          !"!4!H!Z!n!!!!!!!":"d""d"  #2#;#E#Y###m#c#Z#H#4#*#!$c$${$J% T% %B % y&r & ' 'J ( j( (s 3)& ) ) i*H *+W+++Y ,2e, ,}-.I..7/!P=!>!=!2+2222222t2e2V2C2/222}10y0//////z/s/n/f/b/`/b/c/g/l/s/// // ///0 o1%10$02M0C/as/,/.._.. -C -j ]- W- S- L- A- %- - , , , , ,* ,/ ,8 ,7 ,7 ,4 - *- F- ]- - - - . 0. Z. . . . .{ /R s/, / 2000U11{2f2S---8.9v%l7Y]B/%XD      6 V v  [ v' 9 [ j x B ~     < | ! F! ! ! ! ! "} c"a p"L w": }"* }"" |" x" u" r" m" i" ]" R" E" 8" ! ! ! k! C! Q '        % r ; f P X Z Q e K n C x < .   ! ! ! &!j 0!V 9!@ =!5 B!+ E! I! P!U![!_!c!c!d!f!i!mi!Sj!;h! e!c!\!Q!J!}C!l2!K!.!!       e ;  rU9 H U d u# #     # ; V j z  n X C -  k 5GjOZWKc+e"hn u}. H---$Rm}!rcTbds9tqX@&  _C2&#jWD4">KYu3Sct#6JayrdTD2   Q+9KK Y n z  7 W v      >' U; nN n |    , L k      < c f i j lv lf l^ lZ lX lW mW L3 +    vr OV )8        ~p kK X I<740|.d,2,1Ymw|wlb>Lb5 ---$Uzl^R:%#/Jj,S{ i    (N 4s B ^ n , ; L [ l z           y $r +l 4V 8K =A E+ M Z ` f g i m n p{ se u7 v ph mmkh\c7]TJ?2"v[A)---v$9>|fN55 3Ii$:NXZ]cuwieb\ME>---H$#z#p#h#U$DZ$$$ $%+%_%%%%%%'&X&z&f&Z&O&9'!H' u'''''' '7|'ce'Q'?'0'#'H'x$'0'<'J'X'h'x''' (\()((w(_(H(4( (((((((u(\(?( ( ( ('''''''.V'V'|&&&}&m&e&^&&%!%.%<Y%U%l$$E$#####}#d#O#D#-#)#(#*#1#?# J#$ W#9 d#L s#_ #p # # # # # # $ &$ ?$ Y$ u$ }$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $o $X }$M v$D e$3 [$+ R$% G$ =$ &$ $ $ # ########z---$P<+**dy*A*#3*;(*R*g*|******"*'*2*?*N*`*u* ***+<2+_++s+2+*,F,e,,h,P,8,"--+-:-E-N-S-U-R-M-D-8-v(-j-_,U,K,Z,k,+^+/++*RR*))w)Ak)He)K`)OJ)\@)c9)l1)t,)~%);))FN* *<+---$HU% ?% )% % % % $ $. $7 $B $L $X $e $t $ $ $ $ $ % % )% ?% e% w% % % % % % % % % %~ %y %r %j &a &^ &\ &X &R &O &M %&A &&= (&: ,&4 4&' .& && & & & & % % % % % % % % % % {% z% z% z% _% Y% U% ---H$" ' ' ' ,' F' n' ' ' ' ' ' 'v (R (> (9 (6 (1 (0 '( '# '% '' '* '/ '4 '; w'B i'L Z'U M'a 4'{ ' ' ' ---$>( ( ) Y) ) ) ) )s %*_ 8*U L*L * + ,d ,0 - - - v. .l s/R /> X0. T0) P0& (0 0 0 / / / / s/ .( f.- 2.6 -A -O !- z, + 1+3 *u ) ) ). (k 0( ,( +( *( +( ,( 0( <( J( Y( i( y( ( ( ( --- $tP,}x tg\SL@x5W)8jB ~}cM99+V {]@w nifedugPl+swz{zvuw]{6j- (4c|yz4lPjgAWo 2E$\Ksr 8h~     $ 1 7 > C I U _ i Q   o #   e @   \    w + i K : + n T 9 -$ #/ 4 ; K l " - = C K \ o . ; B K l {  I t2 G Z m %| R     6 e    ! P     By sh V A , ; o       m #a -V << K" Q R T X d m v y }  x q Q 3 vWo>h'_VA' l[J;+p@ ---8| ! F k  1 ; @ W G t O ^ k v X } 6 < C Q m {  w E n y b U q  8 ]    , ; .s <o Kk g` oX oV oU pU rS vN rF o@ g6 B .    Y $           z !g .U 3K 9B E0 O Y ] b l v  e H ,  YA*{qfL>/z R?-r[C+rW > &    y f S ? , 4 8 = M _ p   p \ V T S Q G 1 %           s ] ~G q/ d [ S N I G Fx IZ L< R Y d j n t U    g 0 0 W  j =  4g~ _F@(2j ' A Z $t ; X g y  6 d   '. O r  p A  ; j  v S 23 i    % 2 L X e           / < K w= d   y     %'=9^IS[^^ Z? Rh Dt 7 )  x W 6     v h pY WJ A8 *&         & 3 C~ Rx ds vq o p q u |  C o  ; E Y M  Q R O \ I  @ 4 # q  8  d } 3 V &    x O '---6$> oacUNIOHJ P? Q_ T W ] c k s ~ 4 I \ o       5 M e       1 R v    > ~   @| y y w v v t s 'p :n Lj Uh _g ob ^ X U S O L F 8 3 / '  + B V i q z | g X zM qB g; -    ~ B $     P 1     V 6    (         '2vAS@?=-90 'lU~>--- $  '  -sqlite-2.8.17/art/SQLite.gif0000644000175000001440000000576610232547612015504 0ustar drhusers00000000000000GIF89aGa~ĥ,GaI8ͻ`(dihlp,OA I'@pH,HGq08!X$جvzѰyHܴzNaN?~{pR9= s~j t % >y( * \M| 8SDY6LcBA0 qOD ' `Q% ` r<>9AGBk pmÇ P@قw~XPN=O2 t@+JWj 9 % &$3X  C/i`ع!@T2GY'e`h?xW_K5ܵ@RVh h @2v͠ 9܀udZS$ |B}+,hltMKYՁb( j&#TҐy0ܺqrgY8p r ^,Jt?A<R{[ r=4M10 7[^ՆB98q+"Q1pqa.oɑ`@,p@i釡*n338-kЈr?A1z2 ;0]JL5ɤVTE [n3\rD{$J JuTq:k_Y[>pt5Zb`9rH vҹ!f#+"(\Sv%ç>n5wo+Џ H&,i9p*Ne];p ,AdDT}a)?p,6 MImC;s (BN m!Eϙ# V&o̸ H (DV撉G q-L| | =mC}@*}#"}Z4 ê^-ԸKrOAɍqt &9ۂ$W]lt#1Whuhf*R "9.rI8#J?ũ0jմV&`=;GQ:4ӟ["=ۂ&5rU~m`@gs'Ѐ5Ұj76e-Hxځ^z[E1Aa|'diM51hg7*T78&WS'b1GaHd"tw)q4(&8`P!s*_oaj~sx;a!lxipu28p#7 Yv6 Xo{Ϡq ƈ *53zl cIruLh 759* d"em0q0YT؋.!BX/XX7K(؈ ߆O{X0#h4v؎jv!ȎH2?M0}X#h2'"9BJU;sqlite-2.8.17/doc/0000755000175000001440000000000010232547612013615 5ustar drhusers00000000000000sqlite-2.8.17/doc/CVS/0000755000175000001440000000000010251061263014242 5ustar drhusers00000000000000sqlite-2.8.17/doc/CVS/Tag0000644000175000001440000000001310232547612014700 0ustar drhusers00000000000000Tversion_2 sqlite-2.8.17/doc/CVS/Root0000644000175000001440000000004410232547612015114 0ustar drhusers00000000000000:pserver:drh@www.sqlite.org:/sqlite sqlite-2.8.17/doc/CVS/Repository0000644000175000001440000000001310232547612016344 0ustar drhusers00000000000000sqlite/doc sqlite-2.8.17/doc/CVS/Entries0000644000175000001440000000015510251061263015577 0ustar drhusers00000000000000/lemon.html/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /report1.txt/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 D sqlite-2.8.17/doc/report1.txt0000644000175000001440000000645110232547612015760 0ustar drhusers00000000000000An SQLite (version 1.0) database was used in a large military application where the database contained 105 tables and indices. The following is a breakdown on the sizes of keys and data within these tables and indices: Entries: 967089 Size: 45896104 Avg Size: 48 Key Size: 11112265 Avg Key Size: 12 Max Key Size: 99 0..8 263 0% 9..12 5560 0% 13..16 71394 7% 17..24 180717 26% 25..32 215442 48% 33..40 151118 64% 41..48 77479 72% 49..56 13983 74% 57..64 14481 75% 65..80 41342 79% 81..96 127098 92% 97..112 38054 96% 113..128 14197 98% 129..144 8208 99% 145..160 3326 99% 161..176 1242 99% 177..192 604 99% 193..208 222 99% 209..224 213 99% 225..240 132 99% 241..256 58 99% 257..288 515 99% 289..320 64 99% 321..352 39 99% 353..384 44 99% 385..416 25 99% 417..448 24 99% 449..480 26 99% 481..512 27 99% 513..1024 470 99% 1025..2048 396 99% 2049..4096 187 99% 4097..8192 78 99% 8193..16384 35 99% 16385..32768 17 99% 32769..65536 6 99% 65537..65541 3 100% If the indices are omitted, the statistics for the 49 tables become the following: Entries: 451103 Size: 30930282 Avg Size: 69 Key Size: 1804412 Avg Key Size: 4 Max Key Size: 4 0..24 89 0% 25..32 9417 2% 33..40 119162 28% 41..48 68710 43% 49..56 9539 45% 57..64 12435 48% 65..80 38650 57% 81..96 126877 85% 97..112 38030 93% 113..128 14183 96% 129..144 7668 98% 145..160 3302 99% 161..176 1238 99% 177..192 597 99% 193..208 217 99% 209..224 211 99% 225..240 130 99% 241..256 57 99% 257..288 100 99% 289..320 62 99% 321..352 34 99% 353..384 43 99% 385..416 24 99% 417..448 24 99% 449..480 25 99% 481..512 27 99% 513..1024 153 99% 1025..2048 92 99% 2049..4096 7 100% The 56 indices have these statistics: Entries: 512422 Size: 14879828 Avg Size: 30 Key Size: 9253204 Avg Key Size: 19 Max Key Size: 99 0..8 246 0% 9..12 5486 1% 13..16 70717 14% 17..24 178246 49% 25..32 205722 89% 33..40 31951 96% 41..48 8768 97% 49..56 4444 98% 57..64 2046 99% 65..80 2691 99% 81..96 202 99% 97..112 11 99% 113..144 527 99% 145..160 20 99% 161..288 406 99% 289..1024 316 99% 1025..2048 304 99% 2049..4096 180 99% 4097..8192 78 99% 8193..16384 35 99% 16385..32768 17 99% 32769..65536 6 99% 65537..65541 3 100% sqlite-2.8.17/doc/lemon.html0000644000175000001440000010360610232547612015623 0ustar drhusers00000000000000 The Lemon Parser Generator

The Lemon Parser Generator

Lemon is an LALR(1) parser generator for C or C++. It does the same job as ``bison'' and ``yacc''. But lemon is not another bison or yacc clone. It uses a different grammar syntax which is designed to reduce the number of coding errors. Lemon also uses a more sophisticated parsing engine that is faster than yacc and bison and which is both reentrant and thread-safe. Furthermore, Lemon implements features that can be used to eliminate resource leaks, making is suitable for use in long-running programs such as graphical user interfaces or embedded controllers.

This document is an introduction to the Lemon parser generator.

Theory of Operation

The main goal of Lemon is to translate a context free grammar (CFG) for a particular language into C code that implements a parser for that language. The program has two inputs:

Typically, only the grammar specification is supplied by the programmer. Lemon comes with a default parser template which works fine for most applications. But the user is free to substitute a different parser template if desired.

Depending on command-line options, Lemon will generate between one and three files of outputs.

By default, all three of these output files are generated. The header file is suppressed if the ``-m'' command-line option is used and the report file is omitted when ``-q'' is selected.

The grammar specification file uses a ``.y'' suffix, by convention. In the examples used in this document, we'll assume the name of the grammar file is ``gram.y''. A typical use of Lemon would be the following command:

   lemon gram.y
This command will generate three output files named ``gram.c'', ``gram.h'' and ``gram.out''. The first is C code to implement the parser. The second is the header file that defines numerical values for all terminal symbols, and the last is the report that explains the states used by the parser automaton.

Command Line Options

The behavior of Lemon can be modified using command-line options. You can obtain a list of the available command-line options together with a brief explanation of what each does by typing

   lemon -?
As of this writing, the following command-line options are supported: The ``-b'' option reduces the amount of text in the report file by printing only the basis of each parser state, rather than the full configuration. The ``-c'' option suppresses action table compression. Using -c will make the parser a little larger and slower but it will detect syntax errors sooner. The ``-g'' option causes no output files to be generated at all. Instead, the input grammar file is printed on standard output but with all comments, actions and other extraneous text deleted. This is a useful way to get a quick summary of a grammar. The ``-m'' option causes the output C source file to be compatible with the ``makeheaders'' program. Makeheaders is a program that automatically generates header files from C source code. When the ``-m'' option is used, the header file is not output since the makeheaders program will take care of generated all header files automatically. The ``-q'' option suppresses the report file. Using ``-s'' causes a brief summary of parser statistics to be printed. Like this:
   Parser statistics: 74 terminals, 70 nonterminals, 179 rules
                      340 states, 2026 parser table entries, 0 conflicts
Finally, the ``-x'' option causes Lemon to print its version number and then stops without attempting to read the grammar or generate a parser.

The Parser Interface

Lemon doesn't generate a complete, working program. It only generates a few subroutines that implement a parser. This section describes the interface to those subroutines. It is up to the programmer to call these subroutines in an appropriate way in order to produce a complete system.

Before a program begins using a Lemon-generated parser, the program must first create the parser. A new parser is created as follows:

   void *pParser = ParseAlloc( malloc );
The ParseAlloc() routine allocates and initializes a new parser and returns a pointer to it. The actual data structure used to represent a parser is opaque -- its internal structure is not visible or usable by the calling routine. For this reason, the ParseAlloc() routine returns a pointer to void rather than a pointer to some particular structure. The sole argument to the ParseAlloc() routine is a pointer to the subroutine used to allocate memory. Typically this means ``malloc()''.

After a program is finished using a parser, it can reclaim all memory allocated by that parser by calling

   ParseFree(pParser, free);
The first argument is the same pointer returned by ParseAlloc(). The second argument is a pointer to the function used to release bulk memory back to the system.

After a parser has been allocated using ParseAlloc(), the programmer must supply the parser with a sequence of tokens (terminal symbols) to be parsed. This is accomplished by calling the following function once for each token:

   Parse(pParser, hTokenID, sTokenData, pArg);
The first argument to the Parse() routine is the pointer returned by ParseAlloc(). The second argument is a small positive integer that tells the parse the type of the next token in the data stream. There is one token type for each terminal symbol in the grammar. The gram.h file generated by Lemon contains #define statements that map symbolic terminal symbol names into appropriate integer values. (A value of 0 for the second argument is a special flag to the parser to indicate that the end of input has been reached.) The third argument is the value of the given token. By default, the type of the third argument is integer, but the grammar will usually redefine this type to be some kind of structure. Typically the second argument will be a broad category of tokens such as ``identifier'' or ``number'' and the third argument will be the name of the identifier or the value of the number.

The Parse() function may have either three or four arguments, depending on the grammar. If the grammar specification file request it, the Parse() function will have a fourth parameter that can be of any type chosen by the programmer. The parser doesn't do anything with this argument except to pass it through to action routines. This is a convenient mechanism for passing state information down to the action routines without having to use global variables.

A typical use of a Lemon parser might look something like the following:

   01 ParseTree *ParseFile(const char *zFilename){
   02    Tokenizer *pTokenizer;
   03    void *pParser;
   04    Token sToken;
   05    int hTokenId;
   06    ParserState sState;
   07
   08    pTokenizer = TokenizerCreate(zFilename);
   09    pParser = ParseAlloc( malloc );
   10    InitParserState(&sState);
   11    while( GetNextToken(pTokenizer, &hTokenId, &sToken) ){
   12       Parse(pParser, hTokenId, sToken, &sState);
   13    }
   14    Parse(pParser, 0, sToken, &sState);
   15    ParseFree(pParser, free );
   16    TokenizerFree(pTokenizer);
   17    return sState.treeRoot;
   18 }
This example shows a user-written routine that parses a file of text and returns a pointer to the parse tree. (We've omitted all error-handling from this example to keep it simple.) We assume the existence of some kind of tokenizer which is created using TokenizerCreate() on line 8 and deleted by TokenizerFree() on line 16. The GetNextToken() function on line 11 retrieves the next token from the input file and puts its type in the integer variable hTokenId. The sToken variable is assumed to be some kind of structure that contains details about each token, such as its complete text, what line it occurs on, etc.

This example also assumes the existence of structure of type ParserState that holds state information about a particular parse. An instance of such a structure is created on line 6 and initialized on line 10. A pointer to this structure is passed into the Parse() routine as the optional 4th argument. The action routine specified by the grammar for the parser can use the ParserState structure to hold whatever information is useful and appropriate. In the example, we note that the treeRoot field of the ParserState structure is left pointing to the root of the parse tree.

The core of this example as it relates to Lemon is as follows:

   ParseFile(){
      pParser = ParseAlloc( malloc );
      while( GetNextToken(pTokenizer,&hTokenId, &sToken) ){
         Parse(pParser, hTokenId, sToken);
      }
      Parse(pParser, 0, sToken);
      ParseFree(pParser, free );
   }
Basically, what a program has to do to use a Lemon-generated parser is first create the parser, then send it lots of tokens obtained by tokenizing an input source. When the end of input is reached, the Parse() routine should be called one last time with a token type of 0. This step is necessary to inform the parser that the end of input has been reached. Finally, we reclaim memory used by the parser by calling ParseFree().

There is one other interface routine that should be mentioned before we move on. The ParseTrace() function can be used to generate debugging output from the parser. A prototype for this routine is as follows:

   ParseTrace(FILE *stream, char *zPrefix);
After this routine is called, a short (one-line) message is written to the designated output stream every time the parser changes states or calls an action routine. Each such message is prefaced using the text given by zPrefix. This debugging output can be turned off by calling ParseTrace() again with a first argument of NULL (0).

Differences With YACC and BISON

Programmers who have previously used the yacc or bison parser generator will notice several important differences between yacc and/or bison and Lemon.

These differences may cause some initial confusion for programmers with prior yacc and bison experience. But after years of experience using Lemon, I firmly believe that the Lemon way of doing things is better.

Input File Syntax

The main purpose of the grammar specification file for Lemon is to define the grammar for the parser. But the input file also specifies additional information Lemon requires to do its job. Most of the work in using Lemon is in writing an appropriate grammar file.

The grammar file for lemon is, for the most part, free format. It does not have sections or divisions like yacc or bison. Any declaration can occur at any point in the file. Lemon ignores whitespace (except where it is needed to separate tokens) and it honors the same commenting conventions as C and C++.

Terminals and Nonterminals

A terminal symbol (token) is any string of alphanumeric and underscore characters that begins with an upper case letter. A terminal can contain lower class letters after the first character, but the usual convention is to make terminals all upper case. A nonterminal, on the other hand, is any string of alphanumeric and underscore characters than begins with a lower case letter. Again, the usual convention is to make nonterminals use all lower case letters.

In Lemon, terminal and nonterminal symbols do not need to be declared or identified in a separate section of the grammar file. Lemon is able to generate a list of all terminals and nonterminals by examining the grammar rules, and it can always distinguish a terminal from a nonterminal by checking the case of the first character of the name.

Yacc and bison allow terminal symbols to have either alphanumeric names or to be individual characters included in single quotes, like this: ')' or '$'. Lemon does not allow this alternative form for terminal symbols. With Lemon, all symbols, terminals and nonterminals, must have alphanumeric names.

Grammar Rules

The main component of a Lemon grammar file is a sequence of grammar rules. Each grammar rule consists of a nonterminal symbol followed by the special symbol ``::='' and then a list of terminals and/or nonterminals. The rule is terminated by a period. The list of terminals and nonterminals on the right-hand side of the rule can be empty. Rules can occur in any order, except that the left-hand side of the first rule is assumed to be the start symbol for the grammar (unless specified otherwise using the %start directive described below.) A typical sequence of grammar rules might look something like this:

  expr ::= expr PLUS expr.
  expr ::= expr TIMES expr.
  expr ::= LPAREN expr RPAREN.
  expr ::= VALUE.

There is one non-terminal in this example, ``expr'', and five terminal symbols or tokens: ``PLUS'', ``TIMES'', ``LPAREN'', ``RPAREN'' and ``VALUE''.

Like yacc and bison, Lemon allows the grammar to specify a block of C code that will be executed whenever a grammar rule is reduced by the parser. In Lemon, this action is specified by putting the C code (contained within curly braces {...}) immediately after the period that closes the rule. For example:

  expr ::= expr PLUS expr.   { printf("Doing an addition...\n"); }

In order to be useful, grammar actions must normally be linked to their associated grammar rules. In yacc and bison, this is accomplished by embedding a ``$$'' in the action to stand for the value of the left-hand side of the rule and symbols ``$1'', ``$2'', and so forth to stand for the value of the terminal or nonterminal at position 1, 2 and so forth on the right-hand side of the rule. This idea is very powerful, but it is also very error-prone. The single most common source of errors in a yacc or bison grammar is to miscount the number of symbols on the right-hand side of a grammar rule and say ``$7'' when you really mean ``$8''.

Lemon avoids the need to count grammar symbols by assigning symbolic names to each symbol in a grammar rule and then using those symbolic names in the action. In yacc or bison, one would write this:

  expr -> expr PLUS expr  { $$ = $1 + $3; };
But in Lemon, the same rule becomes the following:
  expr(A) ::= expr(B) PLUS expr(C).  { A = B+C; }
In the Lemon rule, any symbol in parentheses after a grammar rule symbol becomes a place holder for that symbol in the grammar rule. This place holder can then be used in the associated C action to stand for the value of that symbol.

The Lemon notation for linking a grammar rule with its reduce action is superior to yacc/bison on several counts. First, as mentioned above, the Lemon method avoids the need to count grammar symbols. Secondly, if a terminal or nonterminal in a Lemon grammar rule includes a linking symbol in parentheses but that linking symbol is not actually used in the reduce action, then an error message is generated. For example, the rule

  expr(A) ::= expr(B) PLUS expr(C).  { A = B; }
will generate an error because the linking symbol ``C'' is used in the grammar rule but not in the reduce action.

The Lemon notation for linking grammar rules to reduce actions also facilitates the use of destructors for reclaiming memory allocated by the values of terminals and nonterminals on the right-hand side of a rule.

Precedence Rules

Lemon resolves parsing ambiguities in exactly the same way as yacc and bison. A shift-reduce conflict is resolved in favor of the shift, and a reduce-reduce conflict is resolved by reducing whichever rule comes first in the grammar file.

Just like in yacc and bison, Lemon allows a measure of control over the resolution of paring conflicts using precedence rules. A precedence value can be assigned to any terminal symbol using the %left, %right or %nonassoc directives. Terminal symbols mentioned in earlier directives have a lower precedence that terminal symbols mentioned in later directives. For example:

   %left AND.
   %left OR.
   %nonassoc EQ NE GT GE LT LE.
   %left PLUS MINUS.
   %left TIMES DIVIDE MOD.
   %right EXP NOT.

In the preceding sequence of directives, the AND operator is defined to have the lowest precedence. The OR operator is one precedence level higher. And so forth. Hence, the grammar would attempt to group the ambiguous expression

     a AND b OR c
like this
     a AND (b OR c).
The associativity (left, right or nonassoc) is used to determine the grouping when the precedence is the same. AND is left-associative in our example, so
     a AND b AND c
is parsed like this
     (a AND b) AND c.
The EXP operator is right-associative, though, so
     a EXP b EXP c
is parsed like this
     a EXP (b EXP c).
The nonassoc precedence is used for non-associative operators. So
     a EQ b EQ c
is an error.

The precedence of non-terminals is transferred to rules as follows: The precedence of a grammar rule is equal to the precedence of the left-most terminal symbol in the rule for which a precedence is defined. This is normally what you want, but in those cases where you want to precedence of a grammar rule to be something different, you can specify an alternative precedence symbol by putting the symbol in square braces after the period at the end of the rule and before any C-code. For example:

   expr = MINUS expr.  [NOT]

This rule has a precedence equal to that of the NOT symbol, not the MINUS symbol as would have been the case by default.

With the knowledge of how precedence is assigned to terminal symbols and individual grammar rules, we can now explain precisely how parsing conflicts are resolved in Lemon. Shift-reduce conflicts are resolved as follows:

Reduce-reduce conflicts are resolved this way:

Special Directives

The input grammar to Lemon consists of grammar rules and special directives. We've described all the grammar rules, so now we'll talk about the special directives.

Directives in lemon can occur in any order. You can put them before the grammar rules, or after the grammar rules, or in the mist of the grammar rules. It doesn't matter. The relative order of directives used to assign precedence to terminals is important, but other than that, the order of directives in Lemon is arbitrary.

Lemon supports the following special directives:

Each of these directives will be described separately in the following sections:

The %code directive

The %code directive is used to specify addition C/C++ code that is added to the end of the main output file. This is similar to the %include directive except that %include is inserted at the beginning of the main output file.

%code is typically used to include some action routines or perhaps a tokenizer as part of the output file.

The %default_destructor directive

The %default_destructor directive specifies a destructor to use for non-terminals that do not have their own destructor specified by a separate %destructor directive. See the documentation on the %destructor directive below for additional information.

In some grammers, many different non-terminal symbols have the same datatype and hence the same destructor. This directive is a convenience way to specify the same destructor for all those non-terminals using a single statement.

The %default_type directive

The %default_type directive specifies the datatype of non-terminal symbols that do no have their own datatype defined using a separate %type directive. See the documentation on %type below for addition information.

The %destructor directive

The %destructor directive is used to specify a destructor for a non-terminal symbol. (See also the %token_destructor directive which is used to specify a destructor for terminal symbols.)

A non-terminal's destructor is called to dispose of the non-terminal's value whenever the non-terminal is popped from the stack. This includes all of the following circumstances:

The destructor can do whatever it wants with the value of the non-terminal, but its design is to deallocate memory or other resources held by that non-terminal.

Consider an example:

   %type nt {void*}
   %destructor nt { free($$); }
   nt(A) ::= ID NUM.   { A = malloc( 100 ); }
This example is a bit contrived but it serves to illustrate how destructors work. The example shows a non-terminal named ``nt'' that holds values of type ``void*''. When the rule for an ``nt'' reduces, it sets the value of the non-terminal to space obtained from malloc(). Later, when the nt non-terminal is popped from the stack, the destructor will fire and call free() on this malloced space, thus avoiding a memory leak. (Note that the symbol ``$$'' in the destructor code is replaced by the value of the non-terminal.)

It is important to note that the value of a non-terminal is passed to the destructor whenever the non-terminal is removed from the stack, unless the non-terminal is used in a C-code action. If the non-terminal is used by C-code, then it is assumed that the C-code will take care of destroying it if it should really be destroyed. More commonly, the value is used to build some larger structure and we don't want to destroy it, which is why the destructor is not called in this circumstance.

By appropriate use of destructors, it is possible to build a parser using Lemon that can be used within a long-running program, such as a GUI, that will not leak memory or other resources. To do the same using yacc or bison is much more difficult.

The %extra_argument directive

The %extra_argument directive instructs Lemon to add a 4th parameter to the parameter list of the Parse() function it generates. Lemon doesn't do anything itself with this extra argument, but it does make the argument available to C-code action routines, destructors, and so forth. For example, if the grammar file contains:

    %extra_argument { MyStruct *pAbc }

Then the Parse() function generated will have an 4th parameter of type ``MyStruct*'' and all action routines will have access to a variable named ``pAbc'' that is the value of the 4th parameter in the most recent call to Parse().

The %include directive

The %include directive specifies C code that is included at the top of the generated parser. You can include any text you want -- the Lemon parser generator copies it blindly. If you have multiple %include directives in your grammar file the value of the last %include directive overwrites all the others.The %include directive is very handy for getting some extra #include preprocessor statements at the beginning of the generated parser. For example:

   %include {#include <unistd.h>}

This might be needed, for example, if some of the C actions in the grammar call functions that are prototyed in unistd.h.

The %left directive

The %left directive is used (along with the %right and %nonassoc directives) to declare precedences of terminal symbols. Every terminal symbol whose name appears after a %left directive but before the next period (``.'') is given the same left-associative precedence value. Subsequent %left directives have higher precedence. For example:

   %left AND.
   %left OR.
   %nonassoc EQ NE GT GE LT LE.
   %left PLUS MINUS.
   %left TIMES DIVIDE MOD.
   %right EXP NOT.

Note the period that terminates each %left, %right or %nonassoc directive.

LALR(1) grammars can get into a situation where they require a large amount of stack space if you make heavy use or right-associative operators. For this reason, it is recommended that you use %left rather than %right whenever possible.

The %name directive

By default, the functions generated by Lemon all begin with the five-character string ``Parse''. You can change this string to something different using the %name directive. For instance:

   %name Abcde

Putting this directive in the grammar file will cause Lemon to generate functions named

The %name directive allows you to generator two or more different parsers and link them all into the same executable.

The %nonassoc directive

This directive is used to assign non-associative precedence to one or more terminal symbols. See the section on precedence rules or on the %left directive for additional information.

The %parse_accept directive

The %parse_accept directive specifies a block of C code that is executed whenever the parser accepts its input string. To ``accept'' an input string means that the parser was able to process all tokens without error.

For example:

   %parse_accept {
      printf("parsing complete!\n");
   }

The %parse_failure directive

The %parse_failure directive specifies a block of C code that is executed whenever the parser fails complete. This code is not executed until the parser has tried and failed to resolve an input error using is usual error recovery strategy. The routine is only invoked when parsing is unable to continue.

   %parse_failure {
     fprintf(stderr,"Giving up.  Parser is hopelessly lost...\n");
   }

The %right directive

This directive is used to assign right-associative precedence to one or more terminal symbols. See the section on precedence rules or on the %left directive for additional information.

The %stack_overflow directive

The %stack_overflow directive specifies a block of C code that is executed if the parser's internal stack ever overflows. Typically this just prints an error message. After a stack overflow, the parser will be unable to continue and must be reset.

   %stack_overflow {
     fprintf(stderr,"Giving up.  Parser stack overflow\n");
   }

You can help prevent parser stack overflows by avoiding the use of right recursion and right-precedence operators in your grammar. Use left recursion and and left-precedence operators instead, to encourage rules to reduce sooner and keep the stack size down. For example, do rules like this:

   list ::= list element.      // left-recursion.  Good!
   list ::= .
Not like this:
   list ::= element list.      // right-recursion.  Bad!
   list ::= .

The %stack_size directive

If stack overflow is a problem and you can't resolve the trouble by using left-recursion, then you might want to increase the size of the parser's stack using this directive. Put an positive integer after the %stack_size directive and Lemon will generate a parse with a stack of the requested size. The default value is 100.

   %stack_size 2000

The %start_symbol directive

By default, the start-symbol for the grammar that Lemon generates is the first non-terminal that appears in the grammar file. But you can choose a different start-symbol using the %start_symbol directive.

   %start_symbol  prog

The %token_destructor directive

The %destructor directive assigns a destructor to a non-terminal symbol. (See the description of the %destructor directive above.) This directive does the same thing for all terminal symbols.

Unlike non-terminal symbols which may each have a different data type for their values, terminals all use the same data type (defined by the %token_type directive) and so they use a common destructor. Other than that, the token destructor works just like the non-terminal destructors.

The %token_prefix directive

Lemon generates #defines that assign small integer constants to each terminal symbol in the grammar. If desired, Lemon will add a prefix specified by this directive to each of the #defines it generates. So if the default output of Lemon looked like this:

    #define AND              1
    #define MINUS            2
    #define OR               3
    #define PLUS             4
You can insert a statement into the grammar like this:
    %token_prefix    TOKEN_
to cause Lemon to produce these symbols instead:
    #define TOKEN_AND        1
    #define TOKEN_MINUS      2
    #define TOKEN_OR         3
    #define TOKEN_PLUS       4

The %token_type and %type directives

These directives are used to specify the data types for values on the parser's stack associated with terminal and non-terminal symbols. The values of all terminal symbols must be of the same type. This turns out to be the same data type as the 3rd parameter to the Parse() function generated by Lemon. Typically, you will make the value of a terminal symbol by a pointer to some kind of token structure. Like this:

   %token_type    {Token*}

If the data type of terminals is not specified, the default value is ``int''.

Non-terminal symbols can each have their own data types. Typically the data type of a non-terminal is a pointer to the root of a parse-tree structure that contains all information about that non-terminal. For example:

   %type   expr  {Expr*}

Each entry on the parser's stack is actually a union containing instances of all data types for every non-terminal and terminal symbol. Lemon will automatically use the correct element of this union depending on what the corresponding non-terminal or terminal symbol is. But the grammar designer should keep in mind that the size of the union will be the size of its largest element. So if you have a single non-terminal whose data type requires 1K of storage, then your 100 entry parser stack will require 100K of heap space. If you are willing and able to pay that price, fine. You just need to know.

Error Processing

After extensive experimentation over several years, it has been discovered that the error recovery strategy used by yacc is about as good as it gets. And so that is what Lemon uses.

When a Lemon-generated parser encounters a syntax error, it first invokes the code specified by the %syntax_error directive, if any. It then enters its error recovery strategy. The error recovery strategy is to begin popping the parsers stack until it enters a state where it is permitted to shift a special non-terminal symbol named ``error''. It then shifts this non-terminal and continues parsing. But the %syntax_error routine will not be called again until at least three new tokens have been successfully shifted.

If the parser pops its stack until the stack is empty, and it still is unable to shift the error symbol, then the %parse_failed routine is invoked and the parser resets itself to its start state, ready to begin parsing a new file. This is what will happen at the very first syntax error, of course, if there are no instances of the ``error'' non-terminal in your grammar.

sqlite-2.8.17/src/0000755000175000001440000000000010351572732013642 5ustar drhusers00000000000000sqlite-2.8.17/src/CVS/0000755000175000001440000000000010351567710014275 5ustar drhusers00000000000000sqlite-2.8.17/src/CVS/Tag0000644000175000001440000000001310232547612014722 0ustar drhusers00000000000000Tversion_2 sqlite-2.8.17/src/CVS/Root0000644000175000001440000000004410232547612015136 0ustar drhusers00000000000000:pserver:drh@www.sqlite.org:/sqlite sqlite-2.8.17/src/CVS/Repository0000644000175000001440000000001310232547612016366 0ustar drhusers00000000000000sqlite/src sqlite-2.8.17/src/CVS/Entries0000644000175000001440000000455410351567710015641 0ustar drhusers00000000000000/attach.c/1.10.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /auth.c/1.12.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /btree.c/1.103/Sat Apr 23 22:43:22 2005//Tversion_2 /btree.h/1.36/Sat Apr 23 22:43:22 2005//Tversion_2 /btree_rb.c/1.24.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /build.c/1.176.2.3/Sat Apr 23 22:43:22 2005//Tversion_2 /copy.c/1.9/Sat Apr 23 22:43:22 2005//Tversion_2 /date.c/1.16.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /delete.c/1.61/Sat Apr 23 22:43:22 2005//Tversion_2 /encode.c/1.12/Sat Apr 23 22:43:22 2005//Tversion_2 /expr.c/1.114.2.4/Sat Apr 23 22:43:22 2005//Tversion_2 /func.c/1.43.2.3/Sat Apr 23 22:43:22 2005//Tversion_2 /hash.c/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /hash.h/1.6/Sat Apr 23 22:43:22 2005//Tversion_2 /insert.c/1.94/Sat Apr 23 22:43:22 2005//Tversion_2 /main.c/1.164.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /md5.c/1.4/Sat Apr 23 22:43:22 2005//Tversion_2 /os.h/1.29/Sat Apr 23 22:43:22 2005//Tversion_2 /pager.h/1.26/Sat Apr 23 22:43:22 2005//Tversion_2 /parse.y/1.112/Sat Apr 23 22:43:22 2005//Tversion_2 /pragma.c/1.19/Sat Apr 23 22:43:22 2005//Tversion_2 /printf.c/1.23.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /random.c/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /select.c/1.161.2.4/Sat Apr 23 22:43:22 2005//Tversion_2 /shell.c/1.93.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /sqlite.h.in/1.60.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /table.c/1.13.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /tclsqlite.c/1.59.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /test1.c/1.36.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /test2.c/1.16/Sat Apr 23 22:43:22 2005//Tversion_2 /test3.c/1.23/Sat Apr 23 22:43:22 2005//Tversion_2 /test4.c/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /tokenize.c/1.68/Sat Apr 23 22:43:22 2005//Tversion_2 /trigger.c/1.44/Sat Apr 23 22:43:22 2005//Tversion_2 /update.c/1.70.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /vacuum.c/1.13.2.5/Sat Apr 23 22:43:22 2005//Tversion_2 /vdbe.c/1.268.2.4/Sat Apr 23 22:43:22 2005//Tversion_2 /vdbe.h/1.71/Sat Apr 23 22:43:22 2005//Tversion_2 /vdbeInt.h/1.7/Sat Apr 23 22:43:22 2005//Tversion_2 /vdbeaux.c/1.18.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /where.c/1.89.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /os.c/1.66.2.5/Mon Jun 6 13:09:17 2005//Tversion_2 /sqliteInt.h/1.220.2.2/Mon Jun 6 15:07:03 2005//Tversion_2 /util.c/1.74.2.2/Mon Jun 6 15:07:03 2005//Tversion_2 /pager.c/1.101.2.1/Mon Dec 19 17:37:10 2005//Tversion_2 D sqlite-2.8.17/src/os.c0000644000175000001440000014471510251045375014440 0ustar drhusers00000000000000/* ** 2001 September 16 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to particular operating ** systems. The purpose of this file is to provide a uniform abstraction ** on which the rest of SQLite can operate. */ #include "os.h" /* Must be first to enable large file support */ #include "sqliteInt.h" #if OS_UNIX # include # include # include # ifndef O_LARGEFILE # define O_LARGEFILE 0 # endif # ifdef SQLITE_DISABLE_LFS # undef O_LARGEFILE # define O_LARGEFILE 0 # endif # ifndef O_NOFOLLOW # define O_NOFOLLOW 0 # endif # ifndef O_BINARY # define O_BINARY 0 # endif #endif #if OS_WIN # include #endif #if OS_MAC # include # include # include # include # include # include # include #endif /* ** The DJGPP compiler environment looks mostly like Unix, but it ** lacks the fcntl() system call. So redefine fcntl() to be something ** that always succeeds. This means that locking does not occur under ** DJGPP. But its DOS - what did you expect? */ #ifdef __DJGPP__ # define fcntl(A,B,C) 0 #endif /* ** Macros used to determine whether or not to use threads. The ** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for ** Posix threads and SQLITE_W32_THREADS is defined if we are ** synchronizing using Win32 threads. */ #if OS_UNIX && defined(THREADSAFE) && THREADSAFE # include # define SQLITE_UNIX_THREADS 1 #endif #if OS_WIN && defined(THREADSAFE) && THREADSAFE # define SQLITE_W32_THREADS 1 #endif #if OS_MAC && defined(THREADSAFE) && THREADSAFE # include # define SQLITE_MACOS_MULTITASKING 1 #endif /* ** Macros for performance tracing. Normally turned off */ #if 0 static int last_page = 0; __inline__ unsigned long long int hwtime(void){ unsigned long long int x; __asm__("rdtsc\n\t" "mov %%edx, %%ecx\n\t" :"=A" (x)); return x; } static unsigned long long int g_start; static unsigned int elapse; #define TIMER_START g_start=hwtime() #define TIMER_END elapse=hwtime()-g_start #define SEEK(X) last_page=(X) #define TRACE1(X) fprintf(stderr,X) #define TRACE2(X,Y) fprintf(stderr,X,Y) #define TRACE3(X,Y,Z) fprintf(stderr,X,Y,Z) #define TRACE4(X,Y,Z,A) fprintf(stderr,X,Y,Z,A) #define TRACE5(X,Y,Z,A,B) fprintf(stderr,X,Y,Z,A,B) #else #define TIMER_START #define TIMER_END #define SEEK(X) #define TRACE1(X) #define TRACE2(X,Y) #define TRACE3(X,Y,Z) #define TRACE4(X,Y,Z,A) #define TRACE5(X,Y,Z,A,B) #endif #if OS_UNIX /* ** Here is the dirt on POSIX advisory locks: ANSI STD 1003.1 (1996) ** section 6.5.2.2 lines 483 through 490 specify that when a process ** sets or clears a lock, that operation overrides any prior locks set ** by the same process. It does not explicitly say so, but this implies ** that it overrides locks set by the same process using a different ** file descriptor. Consider this test case: ** ** int fd1 = open("./file1", O_RDWR|O_CREAT, 0644); ** int fd2 = open("./file2", O_RDWR|O_CREAT, 0644); ** ** Suppose ./file1 and ./file2 are really the same file (because ** one is a hard or symbolic link to the other) then if you set ** an exclusive lock on fd1, then try to get an exclusive lock ** on fd2, it works. I would have expected the second lock to ** fail since there was already a lock on the file due to fd1. ** But not so. Since both locks came from the same process, the ** second overrides the first, even though they were on different ** file descriptors opened on different file names. ** ** Bummer. If you ask me, this is broken. Badly broken. It means ** that we cannot use POSIX locks to synchronize file access among ** competing threads of the same process. POSIX locks will work fine ** to synchronize access for threads in separate processes, but not ** threads within the same process. ** ** To work around the problem, SQLite has to manage file locks internally ** on its own. Whenever a new database is opened, we have to find the ** specific inode of the database file (the inode is determined by the ** st_dev and st_ino fields of the stat structure that fstat() fills in) ** and check for locks already existing on that inode. When locks are ** created or removed, we have to look at our own internal record of the ** locks to see if another thread has previously set a lock on that same ** inode. ** ** The OsFile structure for POSIX is no longer just an integer file ** descriptor. It is now a structure that holds the integer file ** descriptor and a pointer to a structure that describes the internal ** locks on the corresponding inode. There is one locking structure ** per inode, so if the same inode is opened twice, both OsFile structures ** point to the same locking structure. The locking structure keeps ** a reference count (so we will know when to delete it) and a "cnt" ** field that tells us its internal lock status. cnt==0 means the ** file is unlocked. cnt==-1 means the file has an exclusive lock. ** cnt>0 means there are cnt shared locks on the file. ** ** Any attempt to lock or unlock a file first checks the locking ** structure. The fcntl() system call is only invoked to set a ** POSIX lock if the internal lock structure transitions between ** a locked and an unlocked state. ** ** 2004-Jan-11: ** More recent discoveries about POSIX advisory locks. (The more ** I discover, the more I realize the a POSIX advisory locks are ** an abomination.) ** ** If you close a file descriptor that points to a file that has locks, ** all locks on that file that are owned by the current process are ** released. To work around this problem, each OsFile structure contains ** a pointer to an openCnt structure. There is one openCnt structure ** per open inode, which means that multiple OsFiles can point to a single ** openCnt. When an attempt is made to close an OsFile, if there are ** other OsFiles open on the same inode that are holding locks, the call ** to close() the file descriptor is deferred until all of the locks clear. ** The openCnt structure keeps a list of file descriptors that need to ** be closed and that list is walked (and cleared) when the last lock ** clears. ** ** First, under Linux threads, because each thread has a separate ** process ID, lock operations in one thread do not override locks ** to the same file in other threads. Linux threads behave like ** separate processes in this respect. But, if you close a file ** descriptor in linux threads, all locks are cleared, even locks ** on other threads and even though the other threads have different ** process IDs. Linux threads is inconsistent in this respect. ** (I'm beginning to think that linux threads is an abomination too.) ** The consequence of this all is that the hash table for the lockInfo ** structure has to include the process id as part of its key because ** locks in different threads are treated as distinct. But the ** openCnt structure should not include the process id in its ** key because close() clears lock on all threads, not just the current ** thread. Were it not for this goofiness in linux threads, we could ** combine the lockInfo and openCnt structures into a single structure. */ /* ** An instance of the following structure serves as the key used ** to locate a particular lockInfo structure given its inode. Note ** that we have to include the process ID as part of the key. On some ** threading implementations (ex: linux), each thread has a separate ** process ID. */ struct lockKey { dev_t dev; /* Device number */ ino_t ino; /* Inode number */ pid_t pid; /* Process ID */ }; /* ** An instance of the following structure is allocated for each open ** inode on each thread with a different process ID. (Threads have ** different process IDs on linux, but not on most other unixes.) ** ** A single inode can have multiple file descriptors, so each OsFile ** structure contains a pointer to an instance of this object and this ** object keeps a count of the number of OsFiles pointing to it. */ struct lockInfo { struct lockKey key; /* The lookup key */ int cnt; /* 0: unlocked. -1: write lock. 1...: read lock. */ int nRef; /* Number of pointers to this structure */ }; /* ** An instance of the following structure serves as the key used ** to locate a particular openCnt structure given its inode. This ** is the same as the lockKey except that the process ID is omitted. */ struct openKey { dev_t dev; /* Device number */ ino_t ino; /* Inode number */ }; /* ** An instance of the following structure is allocated for each open ** inode. This structure keeps track of the number of locks on that ** inode. If a close is attempted against an inode that is holding ** locks, the close is deferred until all locks clear by adding the ** file descriptor to be closed to the pending list. */ struct openCnt { struct openKey key; /* The lookup key */ int nRef; /* Number of pointers to this structure */ int nLock; /* Number of outstanding locks */ int nPending; /* Number of pending close() operations */ int *aPending; /* Malloced space holding fd's awaiting a close() */ }; /* ** These hash table maps inodes and process IDs into lockInfo and openCnt ** structures. Access to these hash tables must be protected by a mutex. */ static Hash lockHash = { SQLITE_HASH_BINARY, 0, 0, 0, 0, 0 }; static Hash openHash = { SQLITE_HASH_BINARY, 0, 0, 0, 0, 0 }; /* ** Release a lockInfo structure previously allocated by findLockInfo(). */ static void releaseLockInfo(struct lockInfo *pLock){ pLock->nRef--; if( pLock->nRef==0 ){ sqliteHashInsert(&lockHash, &pLock->key, sizeof(pLock->key), 0); sqliteFree(pLock); } } /* ** Release a openCnt structure previously allocated by findLockInfo(). */ static void releaseOpenCnt(struct openCnt *pOpen){ pOpen->nRef--; if( pOpen->nRef==0 ){ sqliteHashInsert(&openHash, &pOpen->key, sizeof(pOpen->key), 0); sqliteFree(pOpen->aPending); sqliteFree(pOpen); } } /* ** Given a file descriptor, locate lockInfo and openCnt structures that ** describes that file descriptor. Create a new ones if necessary. The ** return values might be unset if an error occurs. ** ** Return the number of errors. */ int findLockInfo( int fd, /* The file descriptor used in the key */ struct lockInfo **ppLock, /* Return the lockInfo structure here */ struct openCnt **ppOpen /* Return the openCnt structure here */ ){ int rc; struct lockKey key1; struct openKey key2; struct stat statbuf; struct lockInfo *pLock; struct openCnt *pOpen; rc = fstat(fd, &statbuf); if( rc!=0 ) return 1; memset(&key1, 0, sizeof(key1)); key1.dev = statbuf.st_dev; key1.ino = statbuf.st_ino; key1.pid = getpid(); memset(&key2, 0, sizeof(key2)); key2.dev = statbuf.st_dev; key2.ino = statbuf.st_ino; pLock = (struct lockInfo*)sqliteHashFind(&lockHash, &key1, sizeof(key1)); if( pLock==0 ){ struct lockInfo *pOld; pLock = sqliteMallocRaw( sizeof(*pLock) ); if( pLock==0 ) return 1; pLock->key = key1; pLock->nRef = 1; pLock->cnt = 0; pOld = sqliteHashInsert(&lockHash, &pLock->key, sizeof(key1), pLock); if( pOld!=0 ){ assert( pOld==pLock ); sqliteFree(pLock); return 1; } }else{ pLock->nRef++; } *ppLock = pLock; pOpen = (struct openCnt*)sqliteHashFind(&openHash, &key2, sizeof(key2)); if( pOpen==0 ){ struct openCnt *pOld; pOpen = sqliteMallocRaw( sizeof(*pOpen) ); if( pOpen==0 ){ releaseLockInfo(pLock); return 1; } pOpen->key = key2; pOpen->nRef = 1; pOpen->nLock = 0; pOpen->nPending = 0; pOpen->aPending = 0; pOld = sqliteHashInsert(&openHash, &pOpen->key, sizeof(key2), pOpen); if( pOld!=0 ){ assert( pOld==pOpen ); sqliteFree(pOpen); releaseLockInfo(pLock); return 1; } }else{ pOpen->nRef++; } *ppOpen = pOpen; return 0; } #endif /** POSIX advisory lock work-around **/ /* ** If we compile with the SQLITE_TEST macro set, then the following block ** of code will give us the ability to simulate a disk I/O error. This ** is used for testing the I/O recovery logic. */ #ifdef SQLITE_TEST int sqlite_io_error_pending = 0; #define SimulateIOError(A) \ if( sqlite_io_error_pending ) \ if( sqlite_io_error_pending-- == 1 ){ local_ioerr(); return A; } static void local_ioerr(){ sqlite_io_error_pending = 0; /* Really just a place to set a breakpoint */ } #else #define SimulateIOError(A) #endif /* ** When testing, keep a count of the number of open files. */ #ifdef SQLITE_TEST int sqlite_open_file_count = 0; #define OpenCounter(X) sqlite_open_file_count+=(X) #else #define OpenCounter(X) #endif /* ** Delete the named file */ int sqliteOsDelete(const char *zFilename){ #if OS_UNIX unlink(zFilename); #endif #if OS_WIN DeleteFile(zFilename); #endif #if OS_MAC unlink(zFilename); #endif return SQLITE_OK; } /* ** Return TRUE if the named file exists. */ int sqliteOsFileExists(const char *zFilename){ #if OS_UNIX return access(zFilename, 0)==0; #endif #if OS_WIN return GetFileAttributes(zFilename) != 0xffffffff; #endif #if OS_MAC return access(zFilename, 0)==0; #endif } #if 0 /* NOT USED */ /* ** Change the name of an existing file. */ int sqliteOsFileRename(const char *zOldName, const char *zNewName){ #if OS_UNIX if( link(zOldName, zNewName) ){ return SQLITE_ERROR; } unlink(zOldName); return SQLITE_OK; #endif #if OS_WIN if( !MoveFile(zOldName, zNewName) ){ return SQLITE_ERROR; } return SQLITE_OK; #endif #if OS_MAC /**** FIX ME ***/ return SQLITE_ERROR; #endif } #endif /* NOT USED */ /* ** Attempt to open a file for both reading and writing. If that ** fails, try opening it read-only. If the file does not exist, ** try to create it. ** ** On success, a handle for the open file is written to *id ** and *pReadonly is set to 0 if the file was opened for reading and ** writing or 1 if the file was opened read-only. The function returns ** SQLITE_OK. ** ** On failure, the function returns SQLITE_CANTOPEN and leaves ** *id and *pReadonly unchanged. */ int sqliteOsOpenReadWrite( const char *zFilename, OsFile *id, int *pReadonly ){ #if OS_UNIX int rc; id->dirfd = -1; id->fd = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644); if( id->fd<0 ){ #ifdef EISDIR if( errno==EISDIR ){ return SQLITE_CANTOPEN; } #endif id->fd = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY); if( id->fd<0 ){ return SQLITE_CANTOPEN; } *pReadonly = 1; }else{ *pReadonly = 0; } sqliteOsEnterMutex(); rc = findLockInfo(id->fd, &id->pLock, &id->pOpen); sqliteOsLeaveMutex(); if( rc ){ close(id->fd); return SQLITE_NOMEM; } id->locked = 0; TRACE3("OPEN %-3d %s\n", id->fd, zFilename); OpenCounter(+1); return SQLITE_OK; #endif #if OS_WIN HANDLE h = CreateFile(zFilename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL ); if( h==INVALID_HANDLE_VALUE ){ h = CreateFile(zFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL ); if( h==INVALID_HANDLE_VALUE ){ return SQLITE_CANTOPEN; } *pReadonly = 1; }else{ *pReadonly = 0; } id->h = h; id->locked = 0; OpenCounter(+1); return SQLITE_OK; #endif #if OS_MAC FSSpec fsSpec; # ifdef _LARGE_FILE HFSUniStr255 dfName; FSRef fsRef; if( __path2fss(zFilename, &fsSpec) != noErr ){ if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr ) return SQLITE_CANTOPEN; } if( FSpMakeFSRef(&fsSpec, &fsRef) != noErr ) return SQLITE_CANTOPEN; FSGetDataForkName(&dfName); if( FSOpenFork(&fsRef, dfName.length, dfName.unicode, fsRdWrShPerm, &(id->refNum)) != noErr ){ if( FSOpenFork(&fsRef, dfName.length, dfName.unicode, fsRdWrPerm, &(id->refNum)) != noErr ){ if (FSOpenFork(&fsRef, dfName.length, dfName.unicode, fsRdPerm, &(id->refNum)) != noErr ) return SQLITE_CANTOPEN; else *pReadonly = 1; } else *pReadonly = 0; } else *pReadonly = 0; # else __path2fss(zFilename, &fsSpec); if( !sqliteOsFileExists(zFilename) ){ if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr ) return SQLITE_CANTOPEN; } if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrShPerm, &(id->refNum)) != noErr ){ if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrPerm, &(id->refNum)) != noErr ){ if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdPerm, &(id->refNum)) != noErr ) return SQLITE_CANTOPEN; else *pReadonly = 1; } else *pReadonly = 0; } else *pReadonly = 0; # endif if( HOpenRF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrShPerm, &(id->refNumRF)) != noErr){ id->refNumRF = -1; } id->locked = 0; id->delOnClose = 0; OpenCounter(+1); return SQLITE_OK; #endif } /* ** Attempt to open a new file for exclusive access by this process. ** The file will be opened for both reading and writing. To avoid ** a potential security problem, we do not allow the file to have ** previously existed. Nor do we allow the file to be a symbolic ** link. ** ** If delFlag is true, then make arrangements to automatically delete ** the file when it is closed. ** ** On success, write the file handle into *id and return SQLITE_OK. ** ** On failure, return SQLITE_CANTOPEN. */ int sqliteOsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){ #if OS_UNIX int rc; if( access(zFilename, 0)==0 ){ return SQLITE_CANTOPEN; } id->dirfd = -1; id->fd = open(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_LARGEFILE|O_BINARY, 0600); if( id->fd<0 ){ return SQLITE_CANTOPEN; } sqliteOsEnterMutex(); rc = findLockInfo(id->fd, &id->pLock, &id->pOpen); sqliteOsLeaveMutex(); if( rc ){ close(id->fd); unlink(zFilename); return SQLITE_NOMEM; } id->locked = 0; if( delFlag ){ unlink(zFilename); } TRACE3("OPEN-EX %-3d %s\n", id->fd, zFilename); OpenCounter(+1); return SQLITE_OK; #endif #if OS_WIN HANDLE h; int fileflags; if( delFlag ){ fileflags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_RANDOM_ACCESS | FILE_FLAG_DELETE_ON_CLOSE; }else{ fileflags = FILE_FLAG_RANDOM_ACCESS; } h = CreateFile(zFilename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, fileflags, NULL ); if( h==INVALID_HANDLE_VALUE ){ return SQLITE_CANTOPEN; } id->h = h; id->locked = 0; OpenCounter(+1); return SQLITE_OK; #endif #if OS_MAC FSSpec fsSpec; # ifdef _LARGE_FILE HFSUniStr255 dfName; FSRef fsRef; __path2fss(zFilename, &fsSpec); if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr ) return SQLITE_CANTOPEN; if( FSpMakeFSRef(&fsSpec, &fsRef) != noErr ) return SQLITE_CANTOPEN; FSGetDataForkName(&dfName); if( FSOpenFork(&fsRef, dfName.length, dfName.unicode, fsRdWrPerm, &(id->refNum)) != noErr ) return SQLITE_CANTOPEN; # else __path2fss(zFilename, &fsSpec); if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr ) return SQLITE_CANTOPEN; if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrPerm, &(id->refNum)) != noErr ) return SQLITE_CANTOPEN; # endif id->refNumRF = -1; id->locked = 0; id->delOnClose = delFlag; if (delFlag) id->pathToDel = sqliteOsFullPathname(zFilename); OpenCounter(+1); return SQLITE_OK; #endif } /* ** Attempt to open a new file for read-only access. ** ** On success, write the file handle into *id and return SQLITE_OK. ** ** On failure, return SQLITE_CANTOPEN. */ int sqliteOsOpenReadOnly(const char *zFilename, OsFile *id){ #if OS_UNIX int rc; id->dirfd = -1; id->fd = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY); if( id->fd<0 ){ return SQLITE_CANTOPEN; } sqliteOsEnterMutex(); rc = findLockInfo(id->fd, &id->pLock, &id->pOpen); sqliteOsLeaveMutex(); if( rc ){ close(id->fd); return SQLITE_NOMEM; } id->locked = 0; TRACE3("OPEN-RO %-3d %s\n", id->fd, zFilename); OpenCounter(+1); return SQLITE_OK; #endif #if OS_WIN HANDLE h = CreateFile(zFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL ); if( h==INVALID_HANDLE_VALUE ){ return SQLITE_CANTOPEN; } id->h = h; id->locked = 0; OpenCounter(+1); return SQLITE_OK; #endif #if OS_MAC FSSpec fsSpec; # ifdef _LARGE_FILE HFSUniStr255 dfName; FSRef fsRef; if( __path2fss(zFilename, &fsSpec) != noErr ) return SQLITE_CANTOPEN; if( FSpMakeFSRef(&fsSpec, &fsRef) != noErr ) return SQLITE_CANTOPEN; FSGetDataForkName(&dfName); if( FSOpenFork(&fsRef, dfName.length, dfName.unicode, fsRdPerm, &(id->refNum)) != noErr ) return SQLITE_CANTOPEN; # else __path2fss(zFilename, &fsSpec); if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdPerm, &(id->refNum)) != noErr ) return SQLITE_CANTOPEN; # endif if( HOpenRF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrShPerm, &(id->refNumRF)) != noErr){ id->refNumRF = -1; } id->locked = 0; id->delOnClose = 0; OpenCounter(+1); return SQLITE_OK; #endif } /* ** Attempt to open a file descriptor for the directory that contains a ** file. This file descriptor can be used to fsync() the directory ** in order to make sure the creation of a new file is actually written ** to disk. ** ** This routine is only meaningful for Unix. It is a no-op under ** windows since windows does not support hard links. ** ** On success, a handle for a previously open file is at *id is ** updated with the new directory file descriptor and SQLITE_OK is ** returned. ** ** On failure, the function returns SQLITE_CANTOPEN and leaves ** *id unchanged. */ int sqliteOsOpenDirectory( const char *zDirname, OsFile *id ){ #if OS_UNIX if( id->fd<0 ){ /* Do not open the directory if the corresponding file is not already ** open. */ return SQLITE_CANTOPEN; } assert( id->dirfd<0 ); id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0644); if( id->dirfd<0 ){ return SQLITE_CANTOPEN; } TRACE3("OPENDIR %-3d %s\n", id->dirfd, zDirname); #endif return SQLITE_OK; } /* ** If the following global variable points to a string which is the ** name of a directory, then that directory will be used to store ** temporary files. */ const char *sqlite_temp_directory = 0; /* ** Create a temporary file name in zBuf. zBuf must be big enough to ** hold at least SQLITE_TEMPNAME_SIZE characters. */ int sqliteOsTempFileName(char *zBuf){ #if OS_UNIX static const char *azDirs[] = { 0, "/var/tmp", "/usr/tmp", "/tmp", ".", }; static unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; struct stat buf; const char *zDir = "."; azDirs[0] = sqlite_temp_directory; for(i=0; i0 && zTempPath[i-1]=='\\'; i--){} zTempPath[i] = 0; zDir = zTempPath; }else{ zDir = sqlite_temp_directory; } for(;;){ sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zDir); j = strlen(zBuf); sqliteRandomness(15, &zBuf[j]); for(i=0; i<15; i++, j++){ zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; } zBuf[j] = 0; if( !sqliteOsFileExists(zBuf) ) break; } #endif #if OS_MAC static char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; char *zDir; char zTempPath[SQLITE_TEMPNAME_SIZE]; char zdirName[32]; CInfoPBRec infoRec; Str31 dirName; memset(&infoRec, 0, sizeof(infoRec)); memset(zTempPath, 0, SQLITE_TEMPNAME_SIZE); if( sqlite_temp_directory!=0 ){ zDir = sqlite_temp_directory; }else if( FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder, &(infoRec.dirInfo.ioVRefNum), &(infoRec.dirInfo.ioDrParID)) == noErr ){ infoRec.dirInfo.ioNamePtr = dirName; do{ infoRec.dirInfo.ioFDirIndex = -1; infoRec.dirInfo.ioDrDirID = infoRec.dirInfo.ioDrParID; if( PBGetCatInfoSync(&infoRec) == noErr ){ CopyPascalStringToC(dirName, zdirName); i = strlen(zdirName); memmove(&(zTempPath[i+1]), zTempPath, strlen(zTempPath)); strcpy(zTempPath, zdirName); zTempPath[i] = ':'; }else{ *zTempPath = 0; break; } } while( infoRec.dirInfo.ioDrDirID != fsRtDirID ); zDir = zTempPath; } if( zDir[0]==0 ){ getcwd(zTempPath, SQLITE_TEMPNAME_SIZE-24); zDir = zTempPath; } for(;;){ sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zDir); j = strlen(zBuf); sqliteRandomness(15, &zBuf[j]); for(i=0; i<15; i++, j++){ zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; } zBuf[j] = 0; if( !sqliteOsFileExists(zBuf) ) break; } #endif return SQLITE_OK; } /* ** Close a file. */ int sqliteOsClose(OsFile *id){ #if OS_UNIX sqliteOsUnlock(id); if( id->dirfd>=0 ) close(id->dirfd); id->dirfd = -1; sqliteOsEnterMutex(); if( id->pOpen->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file ** descriptor to pOpen->aPending. It will be automatically closed when ** the last lock is cleared. */ int *aNew; struct openCnt *pOpen = id->pOpen; pOpen->nPending++; aNew = sqliteRealloc( pOpen->aPending, pOpen->nPending*sizeof(int) ); if( aNew==0 ){ /* If a malloc fails, just leak the file descriptor */ }else{ pOpen->aPending = aNew; pOpen->aPending[pOpen->nPending-1] = id->fd; } }else{ /* There are no outstanding locks so we can close the file immediately */ close(id->fd); } releaseLockInfo(id->pLock); releaseOpenCnt(id->pOpen); sqliteOsLeaveMutex(); TRACE2("CLOSE %-3d\n", id->fd); OpenCounter(-1); return SQLITE_OK; #endif #if OS_WIN CloseHandle(id->h); OpenCounter(-1); return SQLITE_OK; #endif #if OS_MAC if( id->refNumRF!=-1 ) FSClose(id->refNumRF); # ifdef _LARGE_FILE FSCloseFork(id->refNum); # else FSClose(id->refNum); # endif if( id->delOnClose ){ unlink(id->pathToDel); sqliteFree(id->pathToDel); } OpenCounter(-1); return SQLITE_OK; #endif } /* ** Read data from a file into a buffer. Return SQLITE_OK if all ** bytes were read successfully and SQLITE_IOERR if anything goes ** wrong. */ int sqliteOsRead(OsFile *id, void *pBuf, int amt){ #if OS_UNIX int got; SimulateIOError(SQLITE_IOERR); TIMER_START; got = read(id->fd, pBuf, amt); TIMER_END; TRACE4("READ %-3d %7d %d\n", id->fd, last_page, elapse); SEEK(0); /* if( got<0 ) got = 0; */ if( got==amt ){ return SQLITE_OK; }else{ return SQLITE_IOERR; } #endif #if OS_WIN DWORD got; SimulateIOError(SQLITE_IOERR); TRACE2("READ %d\n", last_page); if( !ReadFile(id->h, pBuf, amt, &got, 0) ){ got = 0; } if( got==(DWORD)amt ){ return SQLITE_OK; }else{ return SQLITE_IOERR; } #endif #if OS_MAC int got; SimulateIOError(SQLITE_IOERR); TRACE2("READ %d\n", last_page); # ifdef _LARGE_FILE FSReadFork(id->refNum, fsAtMark, 0, (ByteCount)amt, pBuf, (ByteCount*)&got); # else got = amt; FSRead(id->refNum, &got, pBuf); # endif if( got==amt ){ return SQLITE_OK; }else{ return SQLITE_IOERR; } #endif } /* ** Write data from a buffer into a file. Return SQLITE_OK on success ** or some other error code on failure. */ int sqliteOsWrite(OsFile *id, const void *pBuf, int amt){ #if OS_UNIX int wrote = 0; SimulateIOError(SQLITE_IOERR); TIMER_START; while( amt>0 && (wrote = write(id->fd, pBuf, amt))>0 ){ amt -= wrote; pBuf = &((char*)pBuf)[wrote]; } TIMER_END; TRACE4("WRITE %-3d %7d %d\n", id->fd, last_page, elapse); SEEK(0); if( amt>0 ){ return SQLITE_FULL; } return SQLITE_OK; #endif #if OS_WIN int rc; DWORD wrote; SimulateIOError(SQLITE_IOERR); TRACE2("WRITE %d\n", last_page); while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, &wrote, 0))!=0 && wrote>0 ){ amt -= wrote; pBuf = &((char*)pBuf)[wrote]; } if( !rc || amt>(int)wrote ){ return SQLITE_FULL; } return SQLITE_OK; #endif #if OS_MAC OSErr oserr; int wrote = 0; SimulateIOError(SQLITE_IOERR); TRACE2("WRITE %d\n", last_page); while( amt>0 ){ # ifdef _LARGE_FILE oserr = FSWriteFork(id->refNum, fsAtMark, 0, (ByteCount)amt, pBuf, (ByteCount*)&wrote); # else wrote = amt; oserr = FSWrite(id->refNum, &wrote, pBuf); # endif if( wrote == 0 || oserr != noErr) break; amt -= wrote; pBuf = &((char*)pBuf)[wrote]; } if( oserr != noErr || amt>wrote ){ return SQLITE_FULL; } return SQLITE_OK; #endif } /* ** Move the read/write pointer in a file. */ int sqliteOsSeek(OsFile *id, off_t offset){ SEEK(offset/1024 + 1); #if OS_UNIX lseek(id->fd, offset, SEEK_SET); return SQLITE_OK; #endif #if OS_WIN { LONG upperBits = offset>>32; LONG lowerBits = offset & 0xffffffff; DWORD rc; rc = SetFilePointer(id->h, lowerBits, &upperBits, FILE_BEGIN); /* TRACE3("SEEK rc=0x%x upper=0x%x\n", rc, upperBits); */ } return SQLITE_OK; #endif #if OS_MAC { off_t curSize; if( sqliteOsFileSize(id, &curSize) != SQLITE_OK ){ return SQLITE_IOERR; } if( offset >= curSize ){ if( sqliteOsTruncate(id, offset+1) != SQLITE_OK ){ return SQLITE_IOERR; } } # ifdef _LARGE_FILE if( FSSetForkPosition(id->refNum, fsFromStart, offset) != noErr ){ # else if( SetFPos(id->refNum, fsFromStart, offset) != noErr ){ # endif return SQLITE_IOERR; }else{ return SQLITE_OK; } } #endif } #ifdef SQLITE_NOSYNC # define fsync(X) 0 #endif /* ** Make sure all writes to a particular file are committed to disk. ** ** Under Unix, also make sure that the directory entry for the file ** has been created by fsync-ing the directory that contains the file. ** If we do not do this and we encounter a power failure, the directory ** entry for the journal might not exist after we reboot. The next ** SQLite to access the file will not know that the journal exists (because ** the directory entry for the journal was never created) and the transaction ** will not roll back - possibly leading to database corruption. */ int sqliteOsSync(OsFile *id){ #if OS_UNIX SimulateIOError(SQLITE_IOERR); TRACE2("SYNC %-3d\n", id->fd); if( fsync(id->fd) ){ return SQLITE_IOERR; }else{ if( id->dirfd>=0 ){ TRACE2("DIRSYNC %-3d\n", id->dirfd); fsync(id->dirfd); close(id->dirfd); /* Only need to sync once, so close the directory */ id->dirfd = -1; /* when we are done. */ } return SQLITE_OK; } #endif #if OS_WIN if( FlushFileBuffers(id->h) ){ return SQLITE_OK; }else{ return SQLITE_IOERR; } #endif #if OS_MAC # ifdef _LARGE_FILE if( FSFlushFork(id->refNum) != noErr ){ # else ParamBlockRec params; memset(¶ms, 0, sizeof(ParamBlockRec)); params.ioParam.ioRefNum = id->refNum; if( PBFlushFileSync(¶ms) != noErr ){ # endif return SQLITE_IOERR; }else{ return SQLITE_OK; } #endif } /* ** Truncate an open file to a specified size */ int sqliteOsTruncate(OsFile *id, off_t nByte){ SimulateIOError(SQLITE_IOERR); #if OS_UNIX return ftruncate(id->fd, nByte)==0 ? SQLITE_OK : SQLITE_IOERR; #endif #if OS_WIN { LONG upperBits = nByte>>32; SetFilePointer(id->h, nByte, &upperBits, FILE_BEGIN); SetEndOfFile(id->h); } return SQLITE_OK; #endif #if OS_MAC # ifdef _LARGE_FILE if( FSSetForkSize(id->refNum, fsFromStart, nByte) != noErr){ # else if( SetEOF(id->refNum, nByte) != noErr ){ # endif return SQLITE_IOERR; }else{ return SQLITE_OK; } #endif } /* ** Determine the current size of a file in bytes */ int sqliteOsFileSize(OsFile *id, off_t *pSize){ #if OS_UNIX struct stat buf; SimulateIOError(SQLITE_IOERR); if( fstat(id->fd, &buf)!=0 ){ return SQLITE_IOERR; } *pSize = buf.st_size; return SQLITE_OK; #endif #if OS_WIN DWORD upperBits, lowerBits; SimulateIOError(SQLITE_IOERR); lowerBits = GetFileSize(id->h, &upperBits); *pSize = (((off_t)upperBits)<<32) + lowerBits; return SQLITE_OK; #endif #if OS_MAC # ifdef _LARGE_FILE if( FSGetForkSize(id->refNum, pSize) != noErr){ # else if( GetEOF(id->refNum, pSize) != noErr ){ # endif return SQLITE_IOERR; }else{ return SQLITE_OK; } #endif } #if OS_WIN /* ** Return true (non-zero) if we are running under WinNT, Win2K or WinXP. ** Return false (zero) for Win95, Win98, or WinME. ** ** Here is an interesting observation: Win95, Win98, and WinME lack ** the LockFileEx() API. But we can still statically link against that ** API as long as we don't call it win running Win95/98/ME. A call to ** this routine is used to determine if the host is Win95/98/ME or ** WinNT/2K/XP so that we will know whether or not we can safely call ** the LockFileEx() API. */ int isNT(void){ static int osType = 0; /* 0=unknown 1=win95 2=winNT */ if( osType==0 ){ OSVERSIONINFO sInfo; sInfo.dwOSVersionInfoSize = sizeof(sInfo); GetVersionEx(&sInfo); osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; } return osType==2; } #endif /* ** Windows file locking notes: [similar issues apply to MacOS] ** ** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because ** those functions are not available. So we use only LockFile() and ** UnlockFile(). ** ** LockFile() prevents not just writing but also reading by other processes. ** (This is a design error on the part of Windows, but there is nothing ** we can do about that.) So the region used for locking is at the ** end of the file where it is unlikely to ever interfere with an ** actual read attempt. ** ** A database read lock is obtained by locking a single randomly-chosen ** byte out of a specific range of bytes. The lock byte is obtained at ** random so two separate readers can probably access the file at the ** same time, unless they are unlucky and choose the same lock byte. ** A database write lock is obtained by locking all bytes in the range. ** There can only be one writer. ** ** A lock is obtained on the first byte of the lock range before acquiring ** either a read lock or a write lock. This prevents two processes from ** attempting to get a lock at a same time. The semantics of ** sqliteOsReadLock() require that if there is already a write lock, that ** lock is converted into a read lock atomically. The lock on the first ** byte allows us to drop the old write lock and get the read lock without ** another process jumping into the middle and messing us up. The same ** argument applies to sqliteOsWriteLock(). ** ** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available, ** which means we can use reader/writer locks. When reader writer locks ** are used, the lock is placed on the same range of bytes that is used ** for probabilistic locking in Win95/98/ME. Hence, the locking scheme ** will support two or more Win95 readers or two or more WinNT readers. ** But a single Win95 reader will lock out all WinNT readers and a single ** WinNT reader will lock out all other Win95 readers. ** ** Note: On MacOS we use the resource fork for locking. ** ** The following #defines specify the range of bytes used for locking. ** N_LOCKBYTE is the number of bytes available for doing the locking. ** The first byte used to hold the lock while the lock is changing does ** not count toward this number. FIRST_LOCKBYTE is the address of ** the first byte in the range of bytes used for locking. */ #define N_LOCKBYTE 10239 #if OS_MAC # define FIRST_LOCKBYTE (0x000fffff - N_LOCKBYTE) #else # define FIRST_LOCKBYTE (0xffffffff - N_LOCKBYTE) #endif /* ** Change the status of the lock on the file "id" to be a readlock. ** If the file was write locked, then this reduces the lock to a read. ** If the file was read locked, then this acquires a new read lock. ** ** Return SQLITE_OK on success and SQLITE_BUSY on failure. If this ** library was compiled with large file support (LFS) but LFS is not ** available on the host, then an SQLITE_NOLFS is returned. */ int sqliteOsReadLock(OsFile *id){ #if OS_UNIX int rc; sqliteOsEnterMutex(); if( id->pLock->cnt>0 ){ if( !id->locked ){ id->pLock->cnt++; id->locked = 1; id->pOpen->nLock++; } rc = SQLITE_OK; }else if( id->locked || id->pLock->cnt==0 ){ struct flock lock; int s; lock.l_type = F_RDLCK; lock.l_whence = SEEK_SET; lock.l_start = lock.l_len = 0L; s = fcntl(id->fd, F_SETLK, &lock); if( s!=0 ){ rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY; }else{ rc = SQLITE_OK; if( !id->locked ){ id->pOpen->nLock++; id->locked = 1; } id->pLock->cnt = 1; } }else{ rc = SQLITE_BUSY; } sqliteOsLeaveMutex(); return rc; #endif #if OS_WIN int rc; if( id->locked>0 ){ rc = SQLITE_OK; }else{ int lk; int res; int cnt = 100; sqliteRandomness(sizeof(lk), &lk); lk = (lk & 0x7fffffff)%N_LOCKBYTE + 1; while( cnt-->0 && (res = LockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0))==0 ){ Sleep(1); } if( res ){ UnlockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0); if( isNT() ){ OVERLAPPED ovlp; ovlp.Offset = FIRST_LOCKBYTE+1; ovlp.OffsetHigh = 0; ovlp.hEvent = 0; res = LockFileEx(id->h, LOCKFILE_FAIL_IMMEDIATELY, 0, N_LOCKBYTE, 0, &ovlp); }else{ res = LockFile(id->h, FIRST_LOCKBYTE+lk, 0, 1, 0); } UnlockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0); } if( res ){ id->locked = lk; rc = SQLITE_OK; }else{ rc = SQLITE_BUSY; } } return rc; #endif #if OS_MAC int rc; if( id->locked>0 || id->refNumRF == -1 ){ rc = SQLITE_OK; }else{ int lk; OSErr res; int cnt = 5; ParamBlockRec params; sqliteRandomness(sizeof(lk), &lk); lk = (lk & 0x7fffffff)%N_LOCKBYTE + 1; memset(¶ms, 0, sizeof(params)); params.ioParam.ioRefNum = id->refNumRF; params.ioParam.ioPosMode = fsFromStart; params.ioParam.ioPosOffset = FIRST_LOCKBYTE; params.ioParam.ioReqCount = 1; while( cnt-->0 && (res = PBLockRangeSync(¶ms))!=noErr ){ UInt32 finalTicks; Delay(1, &finalTicks); /* 1/60 sec */ } if( res == noErr ){ params.ioParam.ioPosOffset = FIRST_LOCKBYTE+1; params.ioParam.ioReqCount = N_LOCKBYTE; PBUnlockRangeSync(¶ms); params.ioParam.ioPosOffset = FIRST_LOCKBYTE+lk; params.ioParam.ioReqCount = 1; res = PBLockRangeSync(¶ms); params.ioParam.ioPosOffset = FIRST_LOCKBYTE; params.ioParam.ioReqCount = 1; PBUnlockRangeSync(¶ms); } if( res == noErr ){ id->locked = lk; rc = SQLITE_OK; }else{ rc = SQLITE_BUSY; } } return rc; #endif } /* ** Change the lock status to be an exclusive or write lock. Return ** SQLITE_OK on success and SQLITE_BUSY on a failure. If this ** library was compiled with large file support (LFS) but LFS is not ** available on the host, then an SQLITE_NOLFS is returned. */ int sqliteOsWriteLock(OsFile *id){ #if OS_UNIX int rc; sqliteOsEnterMutex(); if( id->pLock->cnt==0 || (id->pLock->cnt==1 && id->locked==1) ){ struct flock lock; int s; lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; lock.l_start = lock.l_len = 0L; s = fcntl(id->fd, F_SETLK, &lock); if( s!=0 ){ rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY; }else{ rc = SQLITE_OK; if( !id->locked ){ id->pOpen->nLock++; id->locked = 1; } id->pLock->cnt = -1; } }else{ rc = SQLITE_BUSY; } sqliteOsLeaveMutex(); return rc; #endif #if OS_WIN int rc; if( id->locked<0 ){ rc = SQLITE_OK; }else{ int res; int cnt = 100; while( cnt-->0 && (res = LockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0))==0 ){ Sleep(1); } if( res ){ if( id->locked>0 ){ if( isNT() ){ UnlockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0); }else{ res = UnlockFile(id->h, FIRST_LOCKBYTE + id->locked, 0, 1, 0); } } if( res ){ res = LockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0); }else{ res = 0; } UnlockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0); } if( res ){ id->locked = -1; rc = SQLITE_OK; }else{ rc = SQLITE_BUSY; } } return rc; #endif #if OS_MAC int rc; if( id->locked<0 || id->refNumRF == -1 ){ rc = SQLITE_OK; }else{ OSErr res; int cnt = 5; ParamBlockRec params; memset(¶ms, 0, sizeof(params)); params.ioParam.ioRefNum = id->refNumRF; params.ioParam.ioPosMode = fsFromStart; params.ioParam.ioPosOffset = FIRST_LOCKBYTE; params.ioParam.ioReqCount = 1; while( cnt-->0 && (res = PBLockRangeSync(¶ms))!=noErr ){ UInt32 finalTicks; Delay(1, &finalTicks); /* 1/60 sec */ } if( res == noErr ){ params.ioParam.ioPosOffset = FIRST_LOCKBYTE + id->locked; params.ioParam.ioReqCount = 1; if( id->locked==0 || PBUnlockRangeSync(¶ms)==noErr ){ params.ioParam.ioPosOffset = FIRST_LOCKBYTE+1; params.ioParam.ioReqCount = N_LOCKBYTE; res = PBLockRangeSync(¶ms); }else{ res = afpRangeNotLocked; } params.ioParam.ioPosOffset = FIRST_LOCKBYTE; params.ioParam.ioReqCount = 1; PBUnlockRangeSync(¶ms); } if( res == noErr ){ id->locked = -1; rc = SQLITE_OK; }else{ rc = SQLITE_BUSY; } } return rc; #endif } /* ** Unlock the given file descriptor. If the file descriptor was ** not previously locked, then this routine is a no-op. If this ** library was compiled with large file support (LFS) but LFS is not ** available on the host, then an SQLITE_NOLFS is returned. */ int sqliteOsUnlock(OsFile *id){ #if OS_UNIX int rc; if( !id->locked ) return SQLITE_OK; sqliteOsEnterMutex(); assert( id->pLock->cnt!=0 ); if( id->pLock->cnt>1 ){ id->pLock->cnt--; rc = SQLITE_OK; }else{ struct flock lock; int s; lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = lock.l_len = 0L; s = fcntl(id->fd, F_SETLK, &lock); if( s!=0 ){ rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY; }else{ rc = SQLITE_OK; id->pLock->cnt = 0; } } if( rc==SQLITE_OK ){ /* Decrement the count of locks against this same file. When the ** count reaches zero, close any other file descriptors whose close ** was deferred because of outstanding locks. */ struct openCnt *pOpen = id->pOpen; pOpen->nLock--; assert( pOpen->nLock>=0 ); if( pOpen->nLock==0 && pOpen->nPending>0 ){ int i; for(i=0; inPending; i++){ close(pOpen->aPending[i]); } sqliteFree(pOpen->aPending); pOpen->nPending = 0; pOpen->aPending = 0; } } sqliteOsLeaveMutex(); id->locked = 0; return rc; #endif #if OS_WIN int rc; if( id->locked==0 ){ rc = SQLITE_OK; }else if( isNT() || id->locked<0 ){ UnlockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0); rc = SQLITE_OK; id->locked = 0; }else{ UnlockFile(id->h, FIRST_LOCKBYTE+id->locked, 0, 1, 0); rc = SQLITE_OK; id->locked = 0; } return rc; #endif #if OS_MAC int rc; ParamBlockRec params; memset(¶ms, 0, sizeof(params)); params.ioParam.ioRefNum = id->refNumRF; params.ioParam.ioPosMode = fsFromStart; if( id->locked==0 || id->refNumRF == -1 ){ rc = SQLITE_OK; }else if( id->locked<0 ){ params.ioParam.ioPosOffset = FIRST_LOCKBYTE+1; params.ioParam.ioReqCount = N_LOCKBYTE; PBUnlockRangeSync(¶ms); rc = SQLITE_OK; id->locked = 0; }else{ params.ioParam.ioPosOffset = FIRST_LOCKBYTE+id->locked; params.ioParam.ioReqCount = 1; PBUnlockRangeSync(¶ms); rc = SQLITE_OK; id->locked = 0; } return rc; #endif } /* ** Get information to seed the random number generator. The seed ** is written into the buffer zBuf[256]. The calling function must ** supply a sufficiently large buffer. */ int sqliteOsRandomSeed(char *zBuf){ /* We have to initialize zBuf to prevent valgrind from reporting ** errors. The reports issued by valgrind are incorrect - we would ** prefer that the randomness be increased by making use of the ** uninitialized space in zBuf - but valgrind errors tend to worry ** some users. Rather than argue, it seems easier just to initialize ** the whole array and silence valgrind, even if that means less randomness ** in the random seed. ** ** When testing, initializing zBuf[] to zero is all we do. That means ** that we always use the same random number sequence.* This makes the ** tests repeatable. */ memset(zBuf, 0, 256); #if OS_UNIX && !defined(SQLITE_TEST) { int pid; time((time_t*)zBuf); pid = getpid(); memcpy(&zBuf[sizeof(time_t)], &pid, sizeof(pid)); } #endif #if OS_WIN && !defined(SQLITE_TEST) GetSystemTime((LPSYSTEMTIME)zBuf); #endif #if OS_MAC { int pid; Microseconds((UnsignedWide*)zBuf); pid = getpid(); memcpy(&zBuf[sizeof(UnsignedWide)], &pid, sizeof(pid)); } #endif return SQLITE_OK; } /* ** Sleep for a little while. Return the amount of time slept. */ int sqliteOsSleep(int ms){ #if OS_UNIX #if defined(HAVE_USLEEP) && HAVE_USLEEP usleep(ms*1000); return ms; #else sleep((ms+999)/1000); return 1000*((ms+999)/1000); #endif #endif #if OS_WIN Sleep(ms); return ms; #endif #if OS_MAC UInt32 finalTicks; UInt32 ticks = (((UInt32)ms+16)*3)/50; /* 1/60 sec per tick */ Delay(ticks, &finalTicks); return (int)((ticks*50)/3); #endif } /* ** Static variables used for thread synchronization */ static int inMutex = 0; #ifdef SQLITE_UNIX_THREADS static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; #endif #ifdef SQLITE_W32_THREADS static CRITICAL_SECTION cs; #endif #ifdef SQLITE_MACOS_MULTITASKING static MPCriticalRegionID criticalRegion; #endif /* ** The following pair of routine implement mutual exclusion for ** multi-threaded processes. Only a single thread is allowed to ** executed code that is surrounded by EnterMutex() and LeaveMutex(). ** ** SQLite uses only a single Mutex. There is not much critical ** code and what little there is executes quickly and without blocking. */ void sqliteOsEnterMutex(){ #ifdef SQLITE_UNIX_THREADS pthread_mutex_lock(&mutex); #endif #ifdef SQLITE_W32_THREADS static int isInit = 0; while( !isInit ){ static long lock = 0; if( InterlockedIncrement(&lock)==1 ){ InitializeCriticalSection(&cs); isInit = 1; }else{ Sleep(1); } } EnterCriticalSection(&cs); #endif #ifdef SQLITE_MACOS_MULTITASKING static volatile int notInit = 1; if( notInit ){ if( notInit == 2 ) /* as close as you can get to thread safe init */ MPYield(); else{ notInit = 2; MPCreateCriticalRegion(&criticalRegion); notInit = 0; } } MPEnterCriticalRegion(criticalRegion, kDurationForever); #endif assert( !inMutex ); inMutex = 1; } void sqliteOsLeaveMutex(){ assert( inMutex ); inMutex = 0; #ifdef SQLITE_UNIX_THREADS pthread_mutex_unlock(&mutex); #endif #ifdef SQLITE_W32_THREADS LeaveCriticalSection(&cs); #endif #ifdef SQLITE_MACOS_MULTITASKING MPExitCriticalRegion(criticalRegion); #endif } /* ** Turn a relative pathname into a full pathname. Return a pointer ** to the full pathname stored in space obtained from sqliteMalloc(). ** The calling function is responsible for freeing this space once it ** is no longer needed. */ char *sqliteOsFullPathname(const char *zRelative){ #if OS_UNIX char *zFull = 0; if( zRelative[0]=='/' ){ sqliteSetString(&zFull, zRelative, (char*)0); }else{ char zBuf[5000]; zBuf[0] = 0; sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative, (char*)0); } return zFull; #endif #if OS_WIN char *zNotUsed; char *zFull; int nByte; nByte = GetFullPathName(zRelative, 0, 0, &zNotUsed) + 1; zFull = sqliteMalloc( nByte ); if( zFull==0 ) return 0; GetFullPathName(zRelative, nByte, zFull, &zNotUsed); return zFull; #endif #if OS_MAC char *zFull = 0; if( zRelative[0]==':' ){ char zBuf[_MAX_PATH+1]; sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), &(zRelative[1]), (char*)0); }else{ if( strchr(zRelative, ':') ){ sqliteSetString(&zFull, zRelative, (char*)0); }else{ char zBuf[_MAX_PATH+1]; sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), zRelative, (char*)0); } } return zFull; #endif } /* ** The following variable, if set to a non-zero value, becomes the result ** returned from sqliteOsCurrentTime(). This is used for testing. */ #ifdef SQLITE_TEST int sqlite_current_time = 0; #endif /* ** Find the current time (in Universal Coordinated Time). Write the ** current time and date as a Julian Day number into *prNow and ** return 0. Return 1 if the time and date cannot be found. */ int sqliteOsCurrentTime(double *prNow){ #if OS_UNIX time_t t; time(&t); *prNow = t/86400.0 + 2440587.5; #endif #if OS_WIN FILETIME ft; /* FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). */ double now; GetSystemTimeAsFileTime( &ft ); now = ((double)ft.dwHighDateTime) * 4294967296.0; *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5; #endif #ifdef SQLITE_TEST if( sqlite_current_time ){ *prNow = sqlite_current_time/86400.0 + 2440587.5; } #endif return 0; } sqlite-2.8.17/src/os.h0000644000175000001440000001352610232547612014440 0ustar drhusers00000000000000/* ** 2001 September 16 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This header file (together with is companion C source-code file ** "os.c") attempt to abstract the underlying operating system so that ** the SQLite library will work on both POSIX and windows systems. */ #ifndef _SQLITE_OS_H_ #define _SQLITE_OS_H_ /* ** Helpful hint: To get this to compile on HP/UX, add -D_INCLUDE_POSIX_SOURCE ** to the compiler command line. */ /* ** These #defines should enable >2GB file support on Posix if the ** underlying operating system supports it. If the OS lacks ** large file support, or if the OS is windows, these should be no-ops. ** ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch ** on the compiler command line. This is necessary if you are compiling ** on a recent machine (ex: RedHat 7.2) but you want your code to work ** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2 ** without this option, LFS is enable. But LFS does not exist in the kernel ** in RedHat 6.0, so the code won't work. Hence, for maximum binary ** portability you should omit LFS. ** ** Similar is true for MacOS. LFS is only supported on MacOS 9 and later. */ #ifndef SQLITE_DISABLE_LFS # define _LARGE_FILE 1 # ifndef _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 # endif # define _LARGEFILE_SOURCE 1 #endif /* ** Temporary files are named starting with this prefix followed by 16 random ** alphanumeric characters, and no file extension. They are stored in the ** OS's standard temporary file directory, and are deleted prior to exit. ** If sqlite is being embedded in another program, you may wish to change the ** prefix to reflect your program's name, so that if your program exits ** prematurely, old temporary files can be easily identified. This can be done ** using -DTEMP_FILE_PREFIX=myprefix_ on the compiler command line. */ #ifndef TEMP_FILE_PREFIX # define TEMP_FILE_PREFIX "sqlite_" #endif /* ** Figure out if we are dealing with Unix, Windows or MacOS. ** ** N.B. MacOS means Mac Classic (or Carbon). Treat Darwin (OS X) as Unix. ** The MacOS build is designed to use CodeWarrior (tested with v8) */ #ifndef OS_UNIX # ifndef OS_WIN # ifndef OS_MAC # if defined(__MACOS__) # define OS_MAC 1 # define OS_WIN 0 # define OS_UNIX 0 # elif defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) # define OS_MAC 0 # define OS_WIN 1 # define OS_UNIX 0 # else # define OS_MAC 0 # define OS_WIN 0 # define OS_UNIX 1 # endif # else # define OS_WIN 0 # define OS_UNIX 0 # endif # else # define OS_MAC 0 # define OS_UNIX 0 # endif #else # define OS_MAC 0 # ifndef OS_WIN # define OS_WIN 0 # endif #endif /* ** A handle for an open file is stored in an OsFile object. */ #if OS_UNIX # include # include # include # include typedef struct OsFile OsFile; struct OsFile { struct openCnt *pOpen; /* Info about all open fd's on this inode */ struct lockInfo *pLock; /* Info about locks on this inode */ int fd; /* The file descriptor */ int locked; /* True if this instance holds the lock */ int dirfd; /* File descriptor for the directory */ }; # define SQLITE_TEMPNAME_SIZE 200 # if defined(HAVE_USLEEP) && HAVE_USLEEP # define SQLITE_MIN_SLEEP_MS 1 # else # define SQLITE_MIN_SLEEP_MS 1000 # endif #endif #if OS_WIN #include #include typedef struct OsFile OsFile; struct OsFile { HANDLE h; /* Handle for accessing the file */ int locked; /* 0: unlocked, <0: write lock, >0: read lock */ }; # if defined(_MSC_VER) || defined(__BORLANDC__) typedef __int64 off_t; # else # if !defined(_CYGWIN_TYPES_H) typedef long long off_t; # if defined(__MINGW32__) # define _OFF_T_ # endif # endif # endif # define SQLITE_TEMPNAME_SIZE (MAX_PATH+50) # define SQLITE_MIN_SLEEP_MS 1 #endif #if OS_MAC # include # include typedef struct OsFile OsFile; struct OsFile { SInt16 refNum; /* Data fork/file reference number */ SInt16 refNumRF; /* Resource fork reference number (for locking) */ int locked; /* 0: unlocked, <0: write lock, >0: read lock */ int delOnClose; /* True if file is to be deleted on close */ char *pathToDel; /* Name of file to delete on close */ }; # ifdef _LARGE_FILE typedef SInt64 off_t; # else typedef SInt32 off_t; # endif # define SQLITE_TEMPNAME_SIZE _MAX_PATH # define SQLITE_MIN_SLEEP_MS 17 #endif int sqliteOsDelete(const char*); int sqliteOsFileExists(const char*); int sqliteOsFileRename(const char*, const char*); int sqliteOsOpenReadWrite(const char*, OsFile*, int*); int sqliteOsOpenExclusive(const char*, OsFile*, int); int sqliteOsOpenReadOnly(const char*, OsFile*); int sqliteOsOpenDirectory(const char*, OsFile*); int sqliteOsTempFileName(char*); int sqliteOsClose(OsFile*); int sqliteOsRead(OsFile*, void*, int amt); int sqliteOsWrite(OsFile*, const void*, int amt); int sqliteOsSeek(OsFile*, off_t offset); int sqliteOsSync(OsFile*); int sqliteOsTruncate(OsFile*, off_t size); int sqliteOsFileSize(OsFile*, off_t *pSize); int sqliteOsReadLock(OsFile*); int sqliteOsWriteLock(OsFile*); int sqliteOsUnlock(OsFile*); int sqliteOsRandomSeed(char*); int sqliteOsSleep(int ms); int sqliteOsCurrentTime(double*); void sqliteOsEnterMutex(void); void sqliteOsLeaveMutex(void); char *sqliteOsFullPathname(const char*); #endif /* _SQLITE_OS_H_ */ sqlite-2.8.17/src/tclsqlite.c0000600000175000001440000011131310232547612015777 0ustar drhusers00000000000000/* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** A TCL Interface to SQLite ** ** $Id: tclsqlite.c,v 1.59.2.1 2004/06/19 11:57:40 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ #include "sqliteInt.h" #include "tcl.h" #include #include #include /* ** If TCL uses UTF-8 and SQLite is configured to use iso8859, then we ** have to do a translation when going between the two. Set the ** UTF_TRANSLATION_NEEDED macro to indicate that we need to do ** this translation. */ #if defined(TCL_UTF_MAX) && !defined(SQLITE_UTF8) # define UTF_TRANSLATION_NEEDED 1 #endif /* ** New SQL functions can be created as TCL scripts. Each such function ** is described by an instance of the following structure. */ typedef struct SqlFunc SqlFunc; struct SqlFunc { Tcl_Interp *interp; /* The TCL interpret to execute the function */ char *zScript; /* The script to be run */ SqlFunc *pNext; /* Next function on the list of them all */ }; /* ** There is one instance of this structure for each SQLite database ** that has been opened by the SQLite TCL interface. */ typedef struct SqliteDb SqliteDb; struct SqliteDb { sqlite *db; /* The "real" database structure */ Tcl_Interp *interp; /* The interpreter used for this database */ char *zBusy; /* The busy callback routine */ char *zCommit; /* The commit hook callback routine */ char *zTrace; /* The trace callback routine */ char *zProgress; /* The progress callback routine */ char *zAuth; /* The authorization callback routine */ SqlFunc *pFunc; /* List of SQL functions */ int rc; /* Return code of most recent sqlite_exec() */ }; /* ** An instance of this structure passes information thru the sqlite ** logic from the original TCL command into the callback routine. */ typedef struct CallbackData CallbackData; struct CallbackData { Tcl_Interp *interp; /* The TCL interpreter */ char *zArray; /* The array into which data is written */ Tcl_Obj *pCode; /* The code to execute for each row */ int once; /* Set for first callback only */ int tcl_rc; /* Return code from TCL script */ int nColName; /* Number of entries in the azColName[] array */ char **azColName; /* Column names translated to UTF-8 */ }; #ifdef UTF_TRANSLATION_NEEDED /* ** Called for each row of the result. ** ** This version is used when TCL expects UTF-8 data but the database ** uses the ISO8859 format. A translation must occur from ISO8859 into ** UTF-8. */ static int DbEvalCallback( void *clientData, /* An instance of CallbackData */ int nCol, /* Number of columns in the result */ char ** azCol, /* Data for each column */ char ** azN /* Name for each column */ ){ CallbackData *cbData = (CallbackData*)clientData; int i, rc; Tcl_DString dCol; Tcl_DStringInit(&dCol); if( cbData->azColName==0 ){ assert( cbData->once ); cbData->once = 0; if( cbData->zArray[0] ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", "", 0); } cbData->azColName = malloc( nCol*sizeof(char*) ); if( cbData->azColName==0 ){ return 1; } cbData->nColName = nCol; for(i=0; iazColName[i] = malloc( Tcl_DStringLength(&dCol) + 1 ); if( cbData->azColName[i] ){ strcpy(cbData->azColName[i], Tcl_DStringValue(&dCol)); }else{ return 1; } if( cbData->zArray[0] ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", Tcl_DStringValue(&dCol), TCL_LIST_ELEMENT|TCL_APPEND_VALUE); if( azN[nCol]!=0 ){ Tcl_DString dType; Tcl_DStringInit(&dType); Tcl_DStringAppend(&dType, "typeof:", -1); Tcl_DStringAppend(&dType, Tcl_DStringValue(&dCol), -1); Tcl_DStringFree(&dCol); Tcl_ExternalToUtfDString(NULL, azN[i+nCol], -1, &dCol); Tcl_SetVar2(cbData->interp, cbData->zArray, Tcl_DStringValue(&dType), Tcl_DStringValue(&dCol), TCL_LIST_ELEMENT|TCL_APPEND_VALUE); Tcl_DStringFree(&dType); } } Tcl_DStringFree(&dCol); } } if( azCol!=0 ){ if( cbData->zArray[0] ){ for(i=0; iinterp, cbData->zArray, cbData->azColName[i], Tcl_DStringValue(&dCol), 0); Tcl_DStringFree(&dCol); } }else{ for(i=0; iinterp, cbData->azColName[i], Tcl_DStringValue(&dCol), 0); Tcl_DStringFree(&dCol); } } } rc = Tcl_EvalObj(cbData->interp, cbData->pCode); if( rc==TCL_CONTINUE ) rc = TCL_OK; cbData->tcl_rc = rc; return rc!=TCL_OK; } #endif /* UTF_TRANSLATION_NEEDED */ #ifndef UTF_TRANSLATION_NEEDED /* ** Called for each row of the result. ** ** This version is used when either of the following is true: ** ** (1) This version of TCL uses UTF-8 and the data in the ** SQLite database is already in the UTF-8 format. ** ** (2) This version of TCL uses ISO8859 and the data in the ** SQLite database is already in the ISO8859 format. */ static int DbEvalCallback( void *clientData, /* An instance of CallbackData */ int nCol, /* Number of columns in the result */ char ** azCol, /* Data for each column */ char ** azN /* Name for each column */ ){ CallbackData *cbData = (CallbackData*)clientData; int i, rc; if( azCol==0 || (cbData->once && cbData->zArray[0]) ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", "", 0); for(i=0; iinterp, cbData->zArray, "*", azN[i], TCL_LIST_ELEMENT|TCL_APPEND_VALUE); if( azN[nCol] ){ char *z = sqlite_mprintf("typeof:%s", azN[i]); Tcl_SetVar2(cbData->interp, cbData->zArray, z, azN[i+nCol], TCL_LIST_ELEMENT|TCL_APPEND_VALUE); sqlite_freemem(z); } } cbData->once = 0; } if( azCol!=0 ){ if( cbData->zArray[0] ){ for(i=0; iinterp, cbData->zArray, azN[i], z, 0); } }else{ for(i=0; iinterp, azN[i], z, 0); } } } rc = Tcl_EvalObj(cbData->interp, cbData->pCode); if( rc==TCL_CONTINUE ) rc = TCL_OK; cbData->tcl_rc = rc; return rc!=TCL_OK; } #endif /* ** This is an alternative callback for database queries. Instead ** of invoking a TCL script to handle the result, this callback just ** appends each column of the result to a list. After the query ** is complete, the list is returned. */ static int DbEvalCallback2( void *clientData, /* An instance of CallbackData */ int nCol, /* Number of columns in the result */ char ** azCol, /* Data for each column */ char ** azN /* Name for each column */ ){ Tcl_Obj *pList = (Tcl_Obj*)clientData; int i; if( azCol==0 ) return 0; for(i=0; idb); while( pDb->pFunc ){ SqlFunc *pFunc = pDb->pFunc; pDb->pFunc = pFunc->pNext; Tcl_Free((char*)pFunc); } if( pDb->zBusy ){ Tcl_Free(pDb->zBusy); } if( pDb->zTrace ){ Tcl_Free(pDb->zTrace); } if( pDb->zAuth ){ Tcl_Free(pDb->zAuth); } Tcl_Free((char*)pDb); } /* ** This routine is called when a database file is locked while trying ** to execute SQL. */ static int DbBusyHandler(void *cd, const char *zTable, int nTries){ SqliteDb *pDb = (SqliteDb*)cd; int rc; char zVal[30]; char *zCmd; Tcl_DString cmd; Tcl_DStringInit(&cmd); Tcl_DStringAppend(&cmd, pDb->zBusy, -1); Tcl_DStringAppendElement(&cmd, zTable); sprintf(zVal, " %d", nTries); Tcl_DStringAppend(&cmd, zVal, -1); zCmd = Tcl_DStringValue(&cmd); rc = Tcl_Eval(pDb->interp, zCmd); Tcl_DStringFree(&cmd); if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ return 0; } return 1; } /* ** This routine is invoked as the 'progress callback' for the database. */ static int DbProgressHandler(void *cd){ SqliteDb *pDb = (SqliteDb*)cd; int rc; assert( pDb->zProgress ); rc = Tcl_Eval(pDb->interp, pDb->zProgress); if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ return 1; } return 0; } /* ** This routine is called by the SQLite trace handler whenever a new ** block of SQL is executed. The TCL script in pDb->zTrace is executed. */ static void DbTraceHandler(void *cd, const char *zSql){ SqliteDb *pDb = (SqliteDb*)cd; Tcl_DString str; Tcl_DStringInit(&str); Tcl_DStringAppend(&str, pDb->zTrace, -1); Tcl_DStringAppendElement(&str, zSql); Tcl_Eval(pDb->interp, Tcl_DStringValue(&str)); Tcl_DStringFree(&str); Tcl_ResetResult(pDb->interp); } /* ** This routine is called when a transaction is committed. The ** TCL script in pDb->zCommit is executed. If it returns non-zero or ** if it throws an exception, the transaction is rolled back instead ** of being committed. */ static int DbCommitHandler(void *cd){ SqliteDb *pDb = (SqliteDb*)cd; int rc; rc = Tcl_Eval(pDb->interp, pDb->zCommit); if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ return 1; } return 0; } /* ** This routine is called to evaluate an SQL function implemented ** using TCL script. */ static void tclSqlFunc(sqlite_func *context, int argc, const char **argv){ SqlFunc *p = sqlite_user_data(context); Tcl_DString cmd; int i; int rc; Tcl_DStringInit(&cmd); Tcl_DStringAppend(&cmd, p->zScript, -1); for(i=0; iinterp, Tcl_DStringValue(&cmd)); if( rc ){ sqlite_set_result_error(context, Tcl_GetStringResult(p->interp), -1); }else{ sqlite_set_result_string(context, Tcl_GetStringResult(p->interp), -1); } } #ifndef SQLITE_OMIT_AUTHORIZATION /* ** This is the authentication function. It appends the authentication ** type code and the two arguments to zCmd[] then invokes the result ** on the interpreter. The reply is examined to determine if the ** authentication fails or succeeds. */ static int auth_callback( void *pArg, int code, const char *zArg1, const char *zArg2, const char *zArg3, const char *zArg4 ){ char *zCode; Tcl_DString str; int rc; const char *zReply; SqliteDb *pDb = (SqliteDb*)pArg; switch( code ){ case SQLITE_COPY : zCode="SQLITE_COPY"; break; case SQLITE_CREATE_INDEX : zCode="SQLITE_CREATE_INDEX"; break; case SQLITE_CREATE_TABLE : zCode="SQLITE_CREATE_TABLE"; break; case SQLITE_CREATE_TEMP_INDEX : zCode="SQLITE_CREATE_TEMP_INDEX"; break; case SQLITE_CREATE_TEMP_TABLE : zCode="SQLITE_CREATE_TEMP_TABLE"; break; case SQLITE_CREATE_TEMP_TRIGGER: zCode="SQLITE_CREATE_TEMP_TRIGGER"; break; case SQLITE_CREATE_TEMP_VIEW : zCode="SQLITE_CREATE_TEMP_VIEW"; break; case SQLITE_CREATE_TRIGGER : zCode="SQLITE_CREATE_TRIGGER"; break; case SQLITE_CREATE_VIEW : zCode="SQLITE_CREATE_VIEW"; break; case SQLITE_DELETE : zCode="SQLITE_DELETE"; break; case SQLITE_DROP_INDEX : zCode="SQLITE_DROP_INDEX"; break; case SQLITE_DROP_TABLE : zCode="SQLITE_DROP_TABLE"; break; case SQLITE_DROP_TEMP_INDEX : zCode="SQLITE_DROP_TEMP_INDEX"; break; case SQLITE_DROP_TEMP_TABLE : zCode="SQLITE_DROP_TEMP_TABLE"; break; case SQLITE_DROP_TEMP_TRIGGER : zCode="SQLITE_DROP_TEMP_TRIGGER"; break; case SQLITE_DROP_TEMP_VIEW : zCode="SQLITE_DROP_TEMP_VIEW"; break; case SQLITE_DROP_TRIGGER : zCode="SQLITE_DROP_TRIGGER"; break; case SQLITE_DROP_VIEW : zCode="SQLITE_DROP_VIEW"; break; case SQLITE_INSERT : zCode="SQLITE_INSERT"; break; case SQLITE_PRAGMA : zCode="SQLITE_PRAGMA"; break; case SQLITE_READ : zCode="SQLITE_READ"; break; case SQLITE_SELECT : zCode="SQLITE_SELECT"; break; case SQLITE_TRANSACTION : zCode="SQLITE_TRANSACTION"; break; case SQLITE_UPDATE : zCode="SQLITE_UPDATE"; break; case SQLITE_ATTACH : zCode="SQLITE_ATTACH"; break; case SQLITE_DETACH : zCode="SQLITE_DETACH"; break; default : zCode="????"; break; } Tcl_DStringInit(&str); Tcl_DStringAppend(&str, pDb->zAuth, -1); Tcl_DStringAppendElement(&str, zCode); Tcl_DStringAppendElement(&str, zArg1 ? zArg1 : ""); Tcl_DStringAppendElement(&str, zArg2 ? zArg2 : ""); Tcl_DStringAppendElement(&str, zArg3 ? zArg3 : ""); Tcl_DStringAppendElement(&str, zArg4 ? zArg4 : ""); rc = Tcl_GlobalEval(pDb->interp, Tcl_DStringValue(&str)); Tcl_DStringFree(&str); zReply = Tcl_GetStringResult(pDb->interp); if( strcmp(zReply,"SQLITE_OK")==0 ){ rc = SQLITE_OK; }else if( strcmp(zReply,"SQLITE_DENY")==0 ){ rc = SQLITE_DENY; }else if( strcmp(zReply,"SQLITE_IGNORE")==0 ){ rc = SQLITE_IGNORE; }else{ rc = 999; } return rc; } #endif /* SQLITE_OMIT_AUTHORIZATION */ /* ** The "sqlite" command below creates a new Tcl command for each ** connection it opens to an SQLite database. This routine is invoked ** whenever one of those connection-specific commands is executed ** in Tcl. For example, if you run Tcl code like this: ** ** sqlite db1 "my_database" ** db1 close ** ** The first command opens a connection to the "my_database" database ** and calls that connection "db1". The second command causes this ** subroutine to be invoked. */ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ SqliteDb *pDb = (SqliteDb*)cd; int choice; int rc = TCL_OK; static const char *DB_strs[] = { "authorizer", "busy", "changes", "close", "commit_hook", "complete", "errorcode", "eval", "function", "last_insert_rowid", "last_statement_changes", "onecolumn", "progress", "rekey", "timeout", "trace", 0 }; enum DB_enum { DB_AUTHORIZER, DB_BUSY, DB_CHANGES, DB_CLOSE, DB_COMMIT_HOOK, DB_COMPLETE, DB_ERRORCODE, DB_EVAL, DB_FUNCTION, DB_LAST_INSERT_ROWID, DB_LAST_STATEMENT_CHANGES, DB_ONECOLUMN, DB_PROGRESS, DB_REKEY, DB_TIMEOUT, DB_TRACE }; if( objc<2 ){ Tcl_WrongNumArgs(interp, 1, objv, "SUBCOMMAND ..."); return TCL_ERROR; } if( Tcl_GetIndexFromObj(interp, objv[1], DB_strs, "option", 0, &choice) ){ return TCL_ERROR; } switch( (enum DB_enum)choice ){ /* $db authorizer ?CALLBACK? ** ** Invoke the given callback to authorize each SQL operation as it is ** compiled. 5 arguments are appended to the callback before it is ** invoked: ** ** (1) The authorization type (ex: SQLITE_CREATE_TABLE, SQLITE_INSERT, ...) ** (2) First descriptive name (depends on authorization type) ** (3) Second descriptive name ** (4) Name of the database (ex: "main", "temp") ** (5) Name of trigger that is doing the access ** ** The callback should return on of the following strings: SQLITE_OK, ** SQLITE_IGNORE, or SQLITE_DENY. Any other return value is an error. ** ** If this method is invoked with no arguments, the current authorization ** callback string is returned. */ case DB_AUTHORIZER: { if( objc>3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?"); }else if( objc==2 ){ if( pDb->zAuth ){ Tcl_AppendResult(interp, pDb->zAuth, 0); } }else{ char *zAuth; int len; if( pDb->zAuth ){ Tcl_Free(pDb->zAuth); } zAuth = Tcl_GetStringFromObj(objv[2], &len); if( zAuth && len>0 ){ pDb->zAuth = Tcl_Alloc( len + 1 ); strcpy(pDb->zAuth, zAuth); }else{ pDb->zAuth = 0; } #ifndef SQLITE_OMIT_AUTHORIZATION if( pDb->zAuth ){ pDb->interp = interp; sqlite_set_authorizer(pDb->db, auth_callback, pDb); }else{ sqlite_set_authorizer(pDb->db, 0, 0); } #endif } break; } /* $db busy ?CALLBACK? ** ** Invoke the given callback if an SQL statement attempts to open ** a locked database file. */ case DB_BUSY: { if( objc>3 ){ Tcl_WrongNumArgs(interp, 2, objv, "CALLBACK"); return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBusy ){ Tcl_AppendResult(interp, pDb->zBusy, 0); } }else{ char *zBusy; int len; if( pDb->zBusy ){ Tcl_Free(pDb->zBusy); } zBusy = Tcl_GetStringFromObj(objv[2], &len); if( zBusy && len>0 ){ pDb->zBusy = Tcl_Alloc( len + 1 ); strcpy(pDb->zBusy, zBusy); }else{ pDb->zBusy = 0; } if( pDb->zBusy ){ pDb->interp = interp; sqlite_busy_handler(pDb->db, DbBusyHandler, pDb); }else{ sqlite_busy_handler(pDb->db, 0, 0); } } break; } /* $db progress ?N CALLBACK? ** ** Invoke the given callback every N virtual machine opcodes while executing ** queries. */ case DB_PROGRESS: { if( objc==2 ){ if( pDb->zProgress ){ Tcl_AppendResult(interp, pDb->zProgress, 0); } }else if( objc==4 ){ char *zProgress; int len; int N; if( TCL_OK!=Tcl_GetIntFromObj(interp, objv[2], &N) ){ return TCL_ERROR; }; if( pDb->zProgress ){ Tcl_Free(pDb->zProgress); } zProgress = Tcl_GetStringFromObj(objv[3], &len); if( zProgress && len>0 ){ pDb->zProgress = Tcl_Alloc( len + 1 ); strcpy(pDb->zProgress, zProgress); }else{ pDb->zProgress = 0; } #ifndef SQLITE_OMIT_PROGRESS_CALLBACK if( pDb->zProgress ){ pDb->interp = interp; sqlite_progress_handler(pDb->db, N, DbProgressHandler, pDb); }else{ sqlite_progress_handler(pDb->db, 0, 0, 0); } #endif }else{ Tcl_WrongNumArgs(interp, 2, objv, "N CALLBACK"); return TCL_ERROR; } break; } /* ** $db changes ** ** Return the number of rows that were modified, inserted, or deleted by ** the most recent "eval". */ case DB_CHANGES: { Tcl_Obj *pResult; int nChange; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } nChange = sqlite_changes(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, nChange); break; } /* ** $db last_statement_changes ** ** Return the number of rows that were modified, inserted, or deleted by ** the last statment to complete execution (excluding changes due to ** triggers) */ case DB_LAST_STATEMENT_CHANGES: { Tcl_Obj *pResult; int lsChange; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } lsChange = sqlite_last_statement_changes(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, lsChange); break; } /* $db close ** ** Shutdown the database */ case DB_CLOSE: { Tcl_DeleteCommand(interp, Tcl_GetStringFromObj(objv[0], 0)); break; } /* $db commit_hook ?CALLBACK? ** ** Invoke the given callback just before committing every SQL transaction. ** If the callback throws an exception or returns non-zero, then the ** transaction is aborted. If CALLBACK is an empty string, the callback ** is disabled. */ case DB_COMMIT_HOOK: { if( objc>3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?"); }else if( objc==2 ){ if( pDb->zCommit ){ Tcl_AppendResult(interp, pDb->zCommit, 0); } }else{ char *zCommit; int len; if( pDb->zCommit ){ Tcl_Free(pDb->zCommit); } zCommit = Tcl_GetStringFromObj(objv[2], &len); if( zCommit && len>0 ){ pDb->zCommit = Tcl_Alloc( len + 1 ); strcpy(pDb->zCommit, zCommit); }else{ pDb->zCommit = 0; } if( pDb->zCommit ){ pDb->interp = interp; sqlite_commit_hook(pDb->db, DbCommitHandler, pDb); }else{ sqlite_commit_hook(pDb->db, 0, 0); } } break; } /* $db complete SQL ** ** Return TRUE if SQL is a complete SQL statement. Return FALSE if ** additional lines of input are needed. This is similar to the ** built-in "info complete" command of Tcl. */ case DB_COMPLETE: { Tcl_Obj *pResult; int isComplete; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "SQL"); return TCL_ERROR; } isComplete = sqlite_complete( Tcl_GetStringFromObj(objv[2], 0) ); pResult = Tcl_GetObjResult(interp); Tcl_SetBooleanObj(pResult, isComplete); break; } /* ** $db errorcode ** ** Return the numeric error code that was returned by the most recent ** call to sqlite_exec(). */ case DB_ERRORCODE: { Tcl_SetObjResult(interp, Tcl_NewIntObj(pDb->rc)); break; } /* ** $db eval $sql ?array { ...code... }? ** ** The SQL statement in $sql is evaluated. For each row, the values are ** placed in elements of the array named "array" and ...code... is executed. ** If "array" and "code" are omitted, then no callback is every invoked. ** If "array" is an empty string, then the values are placed in variables ** that have the same name as the fields extracted by the query. */ case DB_EVAL: { CallbackData cbData; char *zErrMsg; char *zSql; #ifdef UTF_TRANSLATION_NEEDED Tcl_DString dSql; int i; #endif if( objc!=5 && objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "SQL ?ARRAY-NAME CODE?"); return TCL_ERROR; } pDb->interp = interp; zSql = Tcl_GetStringFromObj(objv[2], 0); #ifdef UTF_TRANSLATION_NEEDED Tcl_DStringInit(&dSql); Tcl_UtfToExternalDString(NULL, zSql, -1, &dSql); zSql = Tcl_DStringValue(&dSql); #endif Tcl_IncrRefCount(objv[2]); if( objc==5 ){ cbData.interp = interp; cbData.once = 1; cbData.zArray = Tcl_GetStringFromObj(objv[3], 0); cbData.pCode = objv[4]; cbData.tcl_rc = TCL_OK; cbData.nColName = 0; cbData.azColName = 0; zErrMsg = 0; Tcl_IncrRefCount(objv[3]); Tcl_IncrRefCount(objv[4]); rc = sqlite_exec(pDb->db, zSql, DbEvalCallback, &cbData, &zErrMsg); Tcl_DecrRefCount(objv[4]); Tcl_DecrRefCount(objv[3]); if( cbData.tcl_rc==TCL_BREAK ){ cbData.tcl_rc = TCL_OK; } }else{ Tcl_Obj *pList = Tcl_NewObj(); cbData.tcl_rc = TCL_OK; rc = sqlite_exec(pDb->db, zSql, DbEvalCallback2, pList, &zErrMsg); Tcl_SetObjResult(interp, pList); } pDb->rc = rc; if( rc==SQLITE_ABORT ){ if( zErrMsg ) free(zErrMsg); rc = cbData.tcl_rc; }else if( zErrMsg ){ Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); free(zErrMsg); rc = TCL_ERROR; }else if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, sqlite_error_string(rc), 0); rc = TCL_ERROR; }else{ } Tcl_DecrRefCount(objv[2]); #ifdef UTF_TRANSLATION_NEEDED Tcl_DStringFree(&dSql); if( objc==5 && cbData.azColName ){ for(i=0; iinterp = interp; pFunc->pNext = pDb->pFunc; pFunc->zScript = (char*)&pFunc[1]; strcpy(pFunc->zScript, zScript); sqlite_create_function(pDb->db, zName, -1, tclSqlFunc, pFunc); sqlite_function_type(pDb->db, zName, SQLITE_NUMERIC); break; } /* ** $db last_insert_rowid ** ** Return an integer which is the ROWID for the most recent insert. */ case DB_LAST_INSERT_ROWID: { Tcl_Obj *pResult; int rowid; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } rowid = sqlite_last_insert_rowid(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, rowid); break; } /* ** $db onecolumn SQL ** ** Return a single column from a single row of the given SQL query. */ case DB_ONECOLUMN: { char *zSql; char *zErrMsg = 0; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "SQL"); return TCL_ERROR; } zSql = Tcl_GetStringFromObj(objv[2], 0); rc = sqlite_exec(pDb->db, zSql, DbEvalCallback3, interp, &zErrMsg); if( rc==SQLITE_ABORT ){ rc = SQLITE_OK; }else if( zErrMsg ){ Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); free(zErrMsg); rc = TCL_ERROR; }else if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, sqlite_error_string(rc), 0); rc = TCL_ERROR; } break; } /* ** $db rekey KEY ** ** Change the encryption key on the currently open database. */ case DB_REKEY: { int nKey; void *pKey; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "KEY"); return TCL_ERROR; } pKey = Tcl_GetByteArrayFromObj(objv[2], &nKey); #ifdef SQLITE_HAS_CODEC rc = sqlite_rekey(pDb->db, pKey, nKey); if( rc ){ Tcl_AppendResult(interp, sqlite_error_string(rc), 0); rc = TCL_ERROR; } #endif break; } /* ** $db timeout MILLESECONDS ** ** Delay for the number of milliseconds specified when a file is locked. */ case DB_TIMEOUT: { int ms; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "MILLISECONDS"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[2], &ms) ) return TCL_ERROR; sqlite_busy_timeout(pDb->db, ms); break; } /* $db trace ?CALLBACK? ** ** Make arrangements to invoke the CALLBACK routine for each SQL statement ** that is executed. The text of the SQL is appended to CALLBACK before ** it is executed. */ case DB_TRACE: { if( objc>3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?"); }else if( objc==2 ){ if( pDb->zTrace ){ Tcl_AppendResult(interp, pDb->zTrace, 0); } }else{ char *zTrace; int len; if( pDb->zTrace ){ Tcl_Free(pDb->zTrace); } zTrace = Tcl_GetStringFromObj(objv[2], &len); if( zTrace && len>0 ){ pDb->zTrace = Tcl_Alloc( len + 1 ); strcpy(pDb->zTrace, zTrace); }else{ pDb->zTrace = 0; } if( pDb->zTrace ){ pDb->interp = interp; sqlite_trace(pDb->db, DbTraceHandler, pDb); }else{ sqlite_trace(pDb->db, 0, 0); } } break; } } /* End of the SWITCH statement */ return rc; } /* ** sqlite DBNAME FILENAME ?MODE? ?-key KEY? ** ** This is the main Tcl command. When the "sqlite" Tcl command is ** invoked, this routine runs to process that command. ** ** The first argument, DBNAME, is an arbitrary name for a new ** database connection. This command creates a new command named ** DBNAME that is used to control that connection. The database ** connection is deleted when the DBNAME command is deleted. ** ** The second argument is the name of the directory that contains ** the sqlite database that is to be accessed. ** ** For testing purposes, we also support the following: ** ** sqlite -encoding ** ** Return the encoding used by LIKE and GLOB operators. Choices ** are UTF-8 and iso8859. ** ** sqlite -version ** ** Return the version number of the SQLite library. ** ** sqlite -tcl-uses-utf ** ** Return "1" if compiled with a Tcl uses UTF-8. Return "0" if ** not. Used by tests to make sure the library was compiled ** correctly. */ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ int mode; SqliteDb *p; void *pKey = 0; int nKey = 0; const char *zArg; char *zErrMsg; const char *zFile; char zBuf[80]; if( objc==2 ){ zArg = Tcl_GetStringFromObj(objv[1], 0); if( strcmp(zArg,"-encoding")==0 ){ Tcl_AppendResult(interp,sqlite_encoding,0); return TCL_OK; } if( strcmp(zArg,"-version")==0 ){ Tcl_AppendResult(interp,sqlite_version,0); return TCL_OK; } if( strcmp(zArg,"-has-codec")==0 ){ #ifdef SQLITE_HAS_CODEC Tcl_AppendResult(interp,"1",0); #else Tcl_AppendResult(interp,"0",0); #endif return TCL_OK; } if( strcmp(zArg,"-tcl-uses-utf")==0 ){ #ifdef TCL_UTF_MAX Tcl_AppendResult(interp,"1",0); #else Tcl_AppendResult(interp,"0",0); #endif return TCL_OK; } } if( objc==5 || objc==6 ){ zArg = Tcl_GetStringFromObj(objv[objc-2], 0); if( strcmp(zArg,"-key")==0 ){ pKey = Tcl_GetByteArrayFromObj(objv[objc-1], &nKey); objc -= 2; } } if( objc!=3 && objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, #ifdef SQLITE_HAS_CODEC "HANDLE FILENAME ?-key CODEC-KEY?" #else "HANDLE FILENAME ?MODE?" #endif ); return TCL_ERROR; } if( objc==3 ){ mode = 0666; }else if( Tcl_GetIntFromObj(interp, objv[3], &mode)!=TCL_OK ){ return TCL_ERROR; } zErrMsg = 0; p = (SqliteDb*)Tcl_Alloc( sizeof(*p) ); if( p==0 ){ Tcl_SetResult(interp, "malloc failed", TCL_STATIC); return TCL_ERROR; } memset(p, 0, sizeof(*p)); zFile = Tcl_GetStringFromObj(objv[2], 0); #ifdef SQLITE_HAS_CODEC p->db = sqlite_open_encrypted(zFile, pKey, nKey, 0, &zErrMsg); #else p->db = sqlite_open(zFile, mode, &zErrMsg); #endif if( p->db==0 ){ Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); Tcl_Free((char*)p); free(zErrMsg); return TCL_ERROR; } zArg = Tcl_GetStringFromObj(objv[1], 0); Tcl_CreateObjCommand(interp, zArg, DbObjCmd, (char*)p, DbDeleteCmd); /* The return value is the value of the sqlite* pointer */ sprintf(zBuf, "%p", p->db); if( strncmp(zBuf,"0x",2) ){ sprintf(zBuf, "0x%p", p->db); } Tcl_AppendResult(interp, zBuf, 0); /* If compiled with SQLITE_TEST turned on, then register the "md5sum" ** SQL function. */ #ifdef SQLITE_TEST { extern void Md5_Register(sqlite*); Md5_Register(p->db); } #endif return TCL_OK; } /* ** Provide a dummy Tcl_InitStubs if we are using this as a static ** library. */ #ifndef USE_TCL_STUBS # undef Tcl_InitStubs # define Tcl_InitStubs(a,b,c) #endif /* ** Initialize this module. ** ** This Tcl module contains only a single new Tcl command named "sqlite". ** (Hence there is no namespace. There is no point in using a namespace ** if the extension only supplies one new name!) The "sqlite" command is ** used to open a new SQLite database. See the DbMain() routine above ** for additional information. */ int Sqlite_Init(Tcl_Interp *interp){ Tcl_InitStubs(interp, "8.0", 0); Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0); Tcl_PkgProvide(interp, "sqlite", "2.0"); return TCL_OK; } int Tclsqlite_Init(Tcl_Interp *interp){ Tcl_InitStubs(interp, "8.0", 0); Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0); Tcl_PkgProvide(interp, "sqlite", "2.0"); return TCL_OK; } int Sqlite_SafeInit(Tcl_Interp *interp){ return TCL_OK; } int Tclsqlite_SafeInit(Tcl_Interp *interp){ return TCL_OK; } #if 0 /* ** If compiled using mktclapp, this routine runs to initialize ** everything. */ int Et_AppInit(Tcl_Interp *interp){ return Sqlite_Init(interp); } #endif /*************************************************************************** ** The remaining code is only included if the TCLSH macro is defined to ** be an integer greater than 0 */ #if defined(TCLSH) && TCLSH>0 /* ** If the macro TCLSH is defined and is one, then put in code for the ** "main" routine that implement a interactive shell into which the user ** can type TCL commands. */ #if TCLSH==1 static char zMainloop[] = "set line {}\n" "while {![eof stdin]} {\n" "if {$line!=\"\"} {\n" "puts -nonewline \"> \"\n" "} else {\n" "puts -nonewline \"% \"\n" "}\n" "flush stdout\n" "append line [gets stdin]\n" "if {[info complete $line]} {\n" "if {[catch {uplevel #0 $line} result]} {\n" "puts stderr \"Error: $result\"\n" "} elseif {$result!=\"\"} {\n" "puts $result\n" "}\n" "set line {}\n" "} else {\n" "append line \\n\n" "}\n" "}\n" ; #endif /* TCLSH==1 */ int Libsqlite_Init( Tcl_Interp *interp) { #ifdef TCL_THREADS if (Thread_Init(interp) == TCL_ERROR) { return TCL_ERROR; } #endif Sqlite_Init(interp); #ifdef SQLITE_TEST { extern int Sqlitetest1_Init(Tcl_Interp*); extern int Sqlitetest2_Init(Tcl_Interp*); extern int Sqlitetest3_Init(Tcl_Interp*); extern int Md5_Init(Tcl_Interp*); Sqlitetest1_Init(interp); Sqlitetest2_Init(interp); Sqlitetest3_Init(interp); Md5_Init(interp); Tcl_StaticPackage(interp, "sqlite", Libsqlite_Init, Libsqlite_Init); } #endif return TCL_OK; } #define TCLSH_MAIN main /* Needed to fake out mktclapp */ #if TCLSH==1 int TCLSH_MAIN(int argc, char **argv){ #ifndef TCL_THREADS Tcl_Interp *interp; Tcl_FindExecutable(argv[0]); interp = Tcl_CreateInterp(); Libsqlite_Init(interp); if( argc>=2 ){ int i; Tcl_SetVar(interp,"argv0",argv[1],TCL_GLOBAL_ONLY); Tcl_SetVar(interp,"argv", "", TCL_GLOBAL_ONLY); for(i=2; iresult; fprintf(stderr,"%s: %s\n", *argv, zInfo); return TCL_ERROR; } }else{ Tcl_GlobalEval(interp, zMainloop); } return 0; #else Tcl_Main(argc, argv, Libsqlite_Init); #endif /* TCL_THREADS */ return 0; } #endif /* TCLSH==1 */ /* ** If the macro TCLSH is set to 2, then implement a space analysis tool. */ #if TCLSH==2 static char zAnalysis[] = #include "spaceanal_tcl.h" ; int main(int argc, char **argv){ Tcl_Interp *interp; int i; Tcl_FindExecutable(argv[0]); interp = Tcl_CreateInterp(); Libsqlite_Init(interp); Tcl_SetVar(interp,"argv0",argv[0],TCL_GLOBAL_ONLY); Tcl_SetVar(interp,"argv", "", TCL_GLOBAL_ONLY); for(i=1; iresult; fprintf(stderr,"%s: %s\n", *argv, zInfo); return TCL_ERROR; } return 0; } #endif /* TCLSH==2 */ #endif /* TCLSH */ #endif /* NO_TCL */ sqlite-2.8.17/src/sqlite.h.in0000644000175000001440000011360410232547612015723 0ustar drhusers00000000000000/* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. ** ** @(#) $Id: sqlite.h.in,v 1.60.2.1 2004/10/06 15:52:36 drh Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ #include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. */ #ifdef __cplusplus extern "C" { #endif /* ** The version of the SQLite library. */ #ifdef SQLITE_VERSION # undef SQLITE_VERSION #else # define SQLITE_VERSION "--VERS--" #endif /* ** The version string is also compiled into the library so that a program ** can check to make sure that the lib*.a file and the *.h file are from ** the same version. */ extern const char sqlite_version[]; /* ** The SQLITE_UTF8 macro is defined if the library expects to see ** UTF-8 encoded data. The SQLITE_ISO8859 macro is defined if the ** iso8859 encoded should be used. */ #define SQLITE_--ENCODING-- 1 /* ** The following constant holds one of two strings, "UTF-8" or "iso8859", ** depending on which character encoding the SQLite library expects to ** see. The character encoding makes a difference for the LIKE and GLOB ** operators and for the LENGTH() and SUBSTR() functions. */ extern const char sqlite_encoding[]; /* ** Each open sqlite database is represented by an instance of the ** following opaque structure. */ typedef struct sqlite sqlite; /* ** A function to open a new sqlite database. ** ** If the database does not exist and mode indicates write ** permission, then a new database is created. If the database ** does not exist and mode does not indicate write permission, ** then the open fails, an error message generated (if errmsg!=0) ** and the function returns 0. ** ** If mode does not indicates user write permission, then the ** database is opened read-only. ** ** The Truth: As currently implemented, all databases are opened ** for writing all the time. Maybe someday we will provide the ** ability to open a database readonly. The mode parameters is ** provided in anticipation of that enhancement. */ sqlite *sqlite_open(const char *filename, int mode, char **errmsg); /* ** A function to close the database. ** ** Call this function with a pointer to a structure that was previously ** returned from sqlite_open() and the corresponding database will by closed. */ void sqlite_close(sqlite *); /* ** The type for a callback function. */ typedef int (*sqlite_callback)(void*,int,char**, char**); /* ** A function to executes one or more statements of SQL. ** ** If one or more of the SQL statements are queries, then ** the callback function specified by the 3rd parameter is ** invoked once for each row of the query result. This callback ** should normally return 0. If the callback returns a non-zero ** value then the query is aborted, all subsequent SQL statements ** are skipped and the sqlite_exec() function returns the SQLITE_ABORT. ** ** The 4th parameter is an arbitrary pointer that is passed ** to the callback function as its first parameter. ** ** The 2nd parameter to the callback function is the number of ** columns in the query result. The 3rd parameter to the callback ** is an array of strings holding the values for each column. ** The 4th parameter to the callback is an array of strings holding ** the names of each column. ** ** The callback function may be NULL, even for queries. A NULL ** callback is not an error. It just means that no callback ** will be invoked. ** ** If an error occurs while parsing or evaluating the SQL (but ** not while executing the callback) then an appropriate error ** message is written into memory obtained from malloc() and ** *errmsg is made to point to that message. The calling function ** is responsible for freeing the memory that holds the error ** message. Use sqlite_freemem() for this. If errmsg==NULL, ** then no error message is ever written. ** ** The return value is is SQLITE_OK if there are no errors and ** some other return code if there is an error. The particular ** return value depends on the type of error. ** ** If the query could not be executed because a database file is ** locked or busy, then this function returns SQLITE_BUSY. (This ** behavior can be modified somewhat using the sqlite_busy_handler() ** and sqlite_busy_timeout() functions below.) */ int sqlite_exec( sqlite*, /* An open database */ const char *sql, /* SQL to be executed */ sqlite_callback, /* Callback function */ void *, /* 1st argument to callback function */ char **errmsg /* Error msg written here */ ); /* ** Return values for sqlite_exec() and sqlite_step() */ #define SQLITE_OK 0 /* Successful result */ #define SQLITE_ERROR 1 /* SQL error or missing database */ #define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */ #define SQLITE_PERM 3 /* Access permission denied */ #define SQLITE_ABORT 4 /* Callback routine requested an abort */ #define SQLITE_BUSY 5 /* The database file is locked */ #define SQLITE_LOCKED 6 /* A table in the database is locked */ #define SQLITE_NOMEM 7 /* A malloc() failed */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite_interrupt() */ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ #define SQLITE_NOTFOUND 12 /* (Internal Only) Table or record not found */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ #define SQLITE_EMPTY 16 /* (Internal Only) Database table is empty */ #define SQLITE_SCHEMA 17 /* The database schema changed */ #define SQLITE_TOOBIG 18 /* Too much data for one row of a table */ #define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */ #define SQLITE_MISMATCH 20 /* Data type mismatch */ #define SQLITE_MISUSE 21 /* Library used incorrectly */ #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Auxiliary database format error */ #define SQLITE_RANGE 25 /* 2nd parameter to sqlite_bind out of range */ #define SQLITE_NOTADB 26 /* File opened that is not a database file */ #define SQLITE_ROW 100 /* sqlite_step() has another row ready */ #define SQLITE_DONE 101 /* sqlite_step() has finished executing */ /* ** Each entry in an SQLite table has a unique integer key. (The key is ** the value of the INTEGER PRIMARY KEY column if there is such a column, ** otherwise the key is generated at random. The unique key is always ** available as the ROWID, OID, or _ROWID_ column.) The following routine ** returns the integer key of the most recent insert in the database. ** ** This function is similar to the mysql_insert_id() function from MySQL. */ int sqlite_last_insert_rowid(sqlite*); /* ** This function returns the number of database rows that were changed ** (or inserted or deleted) by the most recent called sqlite_exec(). ** ** All changes are counted, even if they were later undone by a ** ROLLBACK or ABORT. Except, changes associated with creating and ** dropping tables are not counted. ** ** If a callback invokes sqlite_exec() recursively, then the changes ** in the inner, recursive call are counted together with the changes ** in the outer call. ** ** SQLite implements the command "DELETE FROM table" without a WHERE clause ** by dropping and recreating the table. (This is much faster than going ** through and deleting individual elements form the table.) Because of ** this optimization, the change count for "DELETE FROM table" will be ** zero regardless of the number of elements that were originally in the ** table. To get an accurate count of the number of rows deleted, use ** "DELETE FROM table WHERE 1" instead. */ int sqlite_changes(sqlite*); /* ** This function returns the number of database rows that were changed ** by the last INSERT, UPDATE, or DELETE statment executed by sqlite_exec(), ** or by the last VM to run to completion. The change count is not updated ** by SQL statements other than INSERT, UPDATE or DELETE. ** ** Changes are counted, even if they are later undone by a ROLLBACK or ** ABORT. Changes associated with trigger programs that execute as a ** result of the INSERT, UPDATE, or DELETE statement are not counted. ** ** If a callback invokes sqlite_exec() recursively, then the changes ** in the inner, recursive call are counted together with the changes ** in the outer call. ** ** SQLite implements the command "DELETE FROM table" without a WHERE clause ** by dropping and recreating the table. (This is much faster than going ** through and deleting individual elements form the table.) Because of ** this optimization, the change count for "DELETE FROM table" will be ** zero regardless of the number of elements that were originally in the ** table. To get an accurate count of the number of rows deleted, use ** "DELETE FROM table WHERE 1" instead. ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ int sqlite_last_statement_changes(sqlite*); /* If the parameter to this routine is one of the return value constants ** defined above, then this routine returns a constant text string which ** descripts (in English) the meaning of the return value. */ const char *sqlite_error_string(int); #define sqliteErrStr sqlite_error_string /* Legacy. Do not use in new code. */ /* This function causes any pending database operation to abort and ** return at its earliest opportunity. This routine is typically ** called in response to a user action such as pressing "Cancel" ** or Ctrl-C where the user wants a long query operation to halt ** immediately. */ void sqlite_interrupt(sqlite*); /* This function returns true if the given input string comprises ** one or more complete SQL statements. ** ** The algorithm is simple. If the last token other than spaces ** and comments is a semicolon, then return true. otherwise return ** false. */ int sqlite_complete(const char *sql); /* ** This routine identifies a callback function that is invoked ** whenever an attempt is made to open a database table that is ** currently locked by another process or thread. If the busy callback ** is NULL, then sqlite_exec() returns SQLITE_BUSY immediately if ** it finds a locked table. If the busy callback is not NULL, then ** sqlite_exec() invokes the callback with three arguments. The ** second argument is the name of the locked table and the third ** argument is the number of times the table has been busy. If the ** busy callback returns 0, then sqlite_exec() immediately returns ** SQLITE_BUSY. If the callback returns non-zero, then sqlite_exec() ** tries to open the table again and the cycle repeats. ** ** The default busy callback is NULL. ** ** Sqlite is re-entrant, so the busy handler may start a new query. ** (It is not clear why anyone would every want to do this, but it ** is allowed, in theory.) But the busy handler may not close the ** database. Closing the database from a busy handler will delete ** data structures out from under the executing query and will ** probably result in a coredump. */ void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*); /* ** This routine sets a busy handler that sleeps for a while when a ** table is locked. The handler will sleep multiple times until ** at least "ms" milleseconds of sleeping have been done. After ** "ms" milleseconds of sleeping, the handler returns 0 which ** causes sqlite_exec() to return SQLITE_BUSY. ** ** Calling this routine with an argument less than or equal to zero ** turns off all busy handlers. */ void sqlite_busy_timeout(sqlite*, int ms); /* ** This next routine is really just a wrapper around sqlite_exec(). ** Instead of invoking a user-supplied callback for each row of the ** result, this routine remembers each row of the result in memory ** obtained from malloc(), then returns all of the result after the ** query has finished. ** ** As an example, suppose the query result where this table: ** ** Name | Age ** ----------------------- ** Alice | 43 ** Bob | 28 ** Cindy | 21 ** ** If the 3rd argument were &azResult then after the function returns ** azResult will contain the following data: ** ** azResult[0] = "Name"; ** azResult[1] = "Age"; ** azResult[2] = "Alice"; ** azResult[3] = "43"; ** azResult[4] = "Bob"; ** azResult[5] = "28"; ** azResult[6] = "Cindy"; ** azResult[7] = "21"; ** ** Notice that there is an extra row of data containing the column ** headers. But the *nrow return value is still 3. *ncolumn is ** set to 2. In general, the number of values inserted into azResult ** will be ((*nrow) + 1)*(*ncolumn). ** ** After the calling function has finished using the result, it should ** pass the result data pointer to sqlite_free_table() in order to ** release the memory that was malloc-ed. Because of the way the ** malloc() happens, the calling function must not try to call ** malloc() directly. Only sqlite_free_table() is able to release ** the memory properly and safely. ** ** The return value of this routine is the same as from sqlite_exec(). */ int sqlite_get_table( sqlite*, /* An open database */ const char *sql, /* SQL to be executed */ char ***resultp, /* Result written to a char *[] that this points to */ int *nrow, /* Number of result rows written here */ int *ncolumn, /* Number of result columns written here */ char **errmsg /* Error msg written here */ ); /* ** Call this routine to free the memory that sqlite_get_table() allocated. */ void sqlite_free_table(char **result); /* ** The following routines are wrappers around sqlite_exec() and ** sqlite_get_table(). The only difference between the routines that ** follow and the originals is that the second argument to the ** routines that follow is really a printf()-style format ** string describing the SQL to be executed. Arguments to the format ** string appear at the end of the argument list. ** ** All of the usual printf formatting options apply. In addition, there ** is a "%q" option. %q works like %s in that it substitutes a null-terminated ** string from the argument list. But %q also doubles every '\'' character. ** %q is designed for use inside a string literal. By doubling each '\'' ** character it escapes that character and allows it to be inserted into ** the string. ** ** For example, so some string variable contains text as follows: ** ** char *zText = "It's a happy day!"; ** ** We can use this text in an SQL statement as follows: ** ** sqlite_exec_printf(db, "INSERT INTO table VALUES('%q')", ** callback1, 0, 0, zText); ** ** Because the %q format string is used, the '\'' character in zText ** is escaped and the SQL generated is as follows: ** ** INSERT INTO table1 VALUES('It''s a happy day!') ** ** This is correct. Had we used %s instead of %q, the generated SQL ** would have looked like this: ** ** INSERT INTO table1 VALUES('It's a happy day!'); ** ** This second example is an SQL syntax error. As a general rule you ** should always use %q instead of %s when inserting text into a string ** literal. */ int sqlite_exec_printf( sqlite*, /* An open database */ const char *sqlFormat, /* printf-style format string for the SQL */ sqlite_callback, /* Callback function */ void *, /* 1st argument to callback function */ char **errmsg, /* Error msg written here */ ... /* Arguments to the format string. */ ); int sqlite_exec_vprintf( sqlite*, /* An open database */ const char *sqlFormat, /* printf-style format string for the SQL */ sqlite_callback, /* Callback function */ void *, /* 1st argument to callback function */ char **errmsg, /* Error msg written here */ va_list ap /* Arguments to the format string. */ ); int sqlite_get_table_printf( sqlite*, /* An open database */ const char *sqlFormat, /* printf-style format string for the SQL */ char ***resultp, /* Result written to a char *[] that this points to */ int *nrow, /* Number of result rows written here */ int *ncolumn, /* Number of result columns written here */ char **errmsg, /* Error msg written here */ ... /* Arguments to the format string */ ); int sqlite_get_table_vprintf( sqlite*, /* An open database */ const char *sqlFormat, /* printf-style format string for the SQL */ char ***resultp, /* Result written to a char *[] that this points to */ int *nrow, /* Number of result rows written here */ int *ncolumn, /* Number of result columns written here */ char **errmsg, /* Error msg written here */ va_list ap /* Arguments to the format string */ ); char *sqlite_mprintf(const char*,...); char *sqlite_vmprintf(const char*, va_list); /* ** Windows systems should call this routine to free memory that ** is returned in the in the errmsg parameter of sqlite_open() when ** SQLite is a DLL. For some reason, it does not work to call free() ** directly. */ void sqlite_freemem(void *p); /* ** Windows systems need functions to call to return the sqlite_version ** and sqlite_encoding strings. */ const char *sqlite_libversion(void); const char *sqlite_libencoding(void); /* ** A pointer to the following structure is used to communicate with ** the implementations of user-defined functions. */ typedef struct sqlite_func sqlite_func; /* ** Use the following routines to create new user-defined functions. See ** the documentation for details. */ int sqlite_create_function( sqlite*, /* Database where the new function is registered */ const char *zName, /* Name of the new function */ int nArg, /* Number of arguments. -1 means any number */ void (*xFunc)(sqlite_func*,int,const char**), /* C code to implement */ void *pUserData /* Available via the sqlite_user_data() call */ ); int sqlite_create_aggregate( sqlite*, /* Database where the new function is registered */ const char *zName, /* Name of the function */ int nArg, /* Number of arguments */ void (*xStep)(sqlite_func*,int,const char**), /* Called for each row */ void (*xFinalize)(sqlite_func*), /* Called once to get final result */ void *pUserData /* Available via the sqlite_user_data() call */ ); /* ** Use the following routine to define the datatype returned by a ** user-defined function. The second argument can be one of the ** constants SQLITE_NUMERIC, SQLITE_TEXT, or SQLITE_ARGS or it ** can be an integer greater than or equal to zero. When the datatype ** parameter is non-negative, the type of the result will be the ** same as the datatype-th argument. If datatype==SQLITE_NUMERIC ** then the result is always numeric. If datatype==SQLITE_TEXT then ** the result is always text. If datatype==SQLITE_ARGS then the result ** is numeric if any argument is numeric and is text otherwise. */ int sqlite_function_type( sqlite *db, /* The database there the function is registered */ const char *zName, /* Name of the function */ int datatype /* The datatype for this function */ ); #define SQLITE_NUMERIC (-1) /* #define SQLITE_TEXT (-2) // See below */ #define SQLITE_ARGS (-3) /* ** SQLite version 3 defines SQLITE_TEXT differently. To allow both ** version 2 and version 3 to be included, undefine them both if a ** conflict is seen. Define SQLITE2_TEXT to be the version 2 value. */ #ifdef SQLITE_TEXT # undef SQLITE_TEXT #else # define SQLITE_TEXT (-2) #endif #define SQLITE2_TEXT (-2) /* ** The user function implementations call one of the following four routines ** in order to return their results. The first parameter to each of these ** routines is a copy of the first argument to xFunc() or xFinialize(). ** The second parameter to these routines is the result to be returned. ** A NULL can be passed as the second parameter to sqlite_set_result_string() ** in order to return a NULL result. ** ** The 3rd argument to _string and _error is the number of characters to ** take from the string. If this argument is negative, then all characters ** up to and including the first '\000' are used. ** ** The sqlite_set_result_string() function allocates a buffer to hold the ** result and returns a pointer to this buffer. The calling routine ** (that is, the implmentation of a user function) can alter the content ** of this buffer if desired. */ char *sqlite_set_result_string(sqlite_func*,const char*,int); void sqlite_set_result_int(sqlite_func*,int); void sqlite_set_result_double(sqlite_func*,double); void sqlite_set_result_error(sqlite_func*,const char*,int); /* ** The pUserData parameter to the sqlite_create_function() and ** sqlite_create_aggregate() routines used to register user functions ** is available to the implementation of the function using this ** call. */ void *sqlite_user_data(sqlite_func*); /* ** Aggregate functions use the following routine to allocate ** a structure for storing their state. The first time this routine ** is called for a particular aggregate, a new structure of size nBytes ** is allocated, zeroed, and returned. On subsequent calls (for the ** same aggregate instance) the same buffer is returned. The implementation ** of the aggregate can use the returned buffer to accumulate data. ** ** The buffer allocated is freed automatically be SQLite. */ void *sqlite_aggregate_context(sqlite_func*, int nBytes); /* ** The next routine returns the number of calls to xStep for a particular ** aggregate function instance. The current call to xStep counts so this ** routine always returns at least 1. */ int sqlite_aggregate_count(sqlite_func*); /* ** This routine registers a callback with the SQLite library. The ** callback is invoked (at compile-time, not at run-time) for each ** attempt to access a column of a table in the database. The callback ** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire ** SQL statement should be aborted with an error and SQLITE_IGNORE ** if the column should be treated as a NULL value. */ int sqlite_set_authorizer( sqlite*, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pUserData ); /* ** The second parameter to the access authorization function above will ** be one of the values below. These values signify what kind of operation ** is to be authorized. The 3rd and 4th parameters to the authorization ** function will be parameters or NULL depending on which of the following ** codes is used as the second parameter. The 5th parameter is the name ** of the database ("main", "temp", etc.) if applicable. The 6th parameter ** is the name of the inner-most trigger or view that is responsible for ** the access attempt or NULL if this access attempt is directly from ** input SQL code. ** ** Arg-3 Arg-4 */ #define SQLITE_COPY 0 /* Table Name File Name */ #define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ #define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ #define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ #define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ #define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ #define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ #define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ #define SQLITE_CREATE_VIEW 8 /* View Name NULL */ #define SQLITE_DELETE 9 /* Table Name NULL */ #define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ #define SQLITE_DROP_TABLE 11 /* Table Name NULL */ #define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ #define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ #define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ #define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ #define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ #define SQLITE_DROP_VIEW 17 /* View Name NULL */ #define SQLITE_INSERT 18 /* Table Name NULL */ #define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ #define SQLITE_READ 20 /* Table Name Column Name */ #define SQLITE_SELECT 21 /* NULL NULL */ #define SQLITE_TRANSACTION 22 /* NULL NULL */ #define SQLITE_UPDATE 23 /* Table Name Column Name */ #define SQLITE_ATTACH 24 /* Filename NULL */ #define SQLITE_DETACH 25 /* Database Name NULL */ /* ** The return value of the authorization function should be one of the ** following constants: */ /* #define SQLITE_OK 0 // Allow access (This is actually defined above) */ #define SQLITE_DENY 1 /* Abort the SQL statement with an error */ #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ /* ** Register a function that is called at every invocation of sqlite_exec() ** or sqlite_compile(). This function can be used (for example) to generate ** a log file of all SQL executed against a database. */ void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*); /*** The Callback-Free API ** ** The following routines implement a new way to access SQLite that does not ** involve the use of callbacks. ** ** An sqlite_vm is an opaque object that represents a single SQL statement ** that is ready to be executed. */ typedef struct sqlite_vm sqlite_vm; /* ** To execute an SQLite query without the use of callbacks, you first have ** to compile the SQL using this routine. The 1st parameter "db" is a pointer ** to an sqlite object obtained from sqlite_open(). The 2nd parameter ** "zSql" is the text of the SQL to be compiled. The remaining parameters ** are all outputs. ** ** *pzTail is made to point to the first character past the end of the first ** SQL statement in zSql. This routine only compiles the first statement ** in zSql, so *pzTail is left pointing to what remains uncompiled. ** ** *ppVm is left pointing to a "virtual machine" that can be used to execute ** the compiled statement. Or if there is an error, *ppVm may be set to NULL. ** If the input text contained no SQL (if the input is and empty string or ** a comment) then *ppVm is set to NULL. ** ** If any errors are detected during compilation, an error message is written ** into space obtained from malloc() and *pzErrMsg is made to point to that ** error message. The calling routine is responsible for freeing the text ** of this message when it has finished with it. Use sqlite_freemem() to ** free the message. pzErrMsg may be NULL in which case no error message ** will be generated. ** ** On success, SQLITE_OK is returned. Otherwise and error code is returned. */ int sqlite_compile( sqlite *db, /* The open database */ const char *zSql, /* SQL statement to be compiled */ const char **pzTail, /* OUT: uncompiled tail of zSql */ sqlite_vm **ppVm, /* OUT: the virtual machine to execute zSql */ char **pzErrmsg /* OUT: Error message. */ ); /* ** After an SQL statement has been compiled, it is handed to this routine ** to be executed. This routine executes the statement as far as it can ** go then returns. The return value will be one of SQLITE_DONE, ** SQLITE_ERROR, SQLITE_BUSY, SQLITE_ROW, or SQLITE_MISUSE. ** ** SQLITE_DONE means that the execute of the SQL statement is complete ** an no errors have occurred. sqlite_step() should not be called again ** for the same virtual machine. *pN is set to the number of columns in ** the result set and *pazColName is set to an array of strings that ** describe the column names and datatypes. The name of the i-th column ** is (*pazColName)[i] and the datatype of the i-th column is ** (*pazColName)[i+*pN]. *pazValue is set to NULL. ** ** SQLITE_ERROR means that the virtual machine encountered a run-time ** error. sqlite_step() should not be called again for the same ** virtual machine. *pN is set to 0 and *pazColName and *pazValue are set ** to NULL. Use sqlite_finalize() to obtain the specific error code ** and the error message text for the error. ** ** SQLITE_BUSY means that an attempt to open the database failed because ** another thread or process is holding a lock. The calling routine ** can try again to open the database by calling sqlite_step() again. ** The return code will only be SQLITE_BUSY if no busy handler is registered ** using the sqlite_busy_handler() or sqlite_busy_timeout() routines. If ** a busy handler callback has been registered but returns 0, then this ** routine will return SQLITE_ERROR and sqltie_finalize() will return ** SQLITE_BUSY when it is called. ** ** SQLITE_ROW means that a single row of the result is now available. ** The data is contained in *pazValue. The value of the i-th column is ** (*azValue)[i]. *pN and *pazColName are set as described in SQLITE_DONE. ** Invoke sqlite_step() again to advance to the next row. ** ** SQLITE_MISUSE is returned if sqlite_step() is called incorrectly. ** For example, if you call sqlite_step() after the virtual machine ** has halted (after a prior call to sqlite_step() has returned SQLITE_DONE) ** or if you call sqlite_step() with an incorrectly initialized virtual ** machine or a virtual machine that has been deleted or that is associated ** with an sqlite structure that has been closed. */ int sqlite_step( sqlite_vm *pVm, /* The virtual machine to execute */ int *pN, /* OUT: Number of columns in result */ const char ***pazValue, /* OUT: Column data */ const char ***pazColName /* OUT: Column names and datatypes */ ); /* ** This routine is called to delete a virtual machine after it has finished ** executing. The return value is the result code. SQLITE_OK is returned ** if the statement executed successfully and some other value is returned if ** there was any kind of error. If an error occurred and pzErrMsg is not ** NULL, then an error message is written into memory obtained from malloc() ** and *pzErrMsg is made to point to that error message. The calling routine ** should use sqlite_freemem() to delete this message when it has finished ** with it. ** ** This routine can be called at any point during the execution of the ** virtual machine. If the virtual machine has not completed execution ** when this routine is called, that is like encountering an error or ** an interrupt. (See sqlite_interrupt().) Incomplete updates may be ** rolled back and transactions cancelled, depending on the circumstances, ** and the result code returned will be SQLITE_ABORT. */ int sqlite_finalize(sqlite_vm*, char **pzErrMsg); /* ** This routine deletes the virtual machine, writes any error message to ** *pzErrMsg and returns an SQLite return code in the same way as the ** sqlite_finalize() function. ** ** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual ** machine loaded with the compiled version of the original query ready for ** execution. ** ** If sqlite_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL. ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ int sqlite_reset(sqlite_vm*, char **pzErrMsg); /* ** If the SQL that was handed to sqlite_compile contains variables that ** are represeted in the SQL text by a question mark ('?'). This routine ** is used to assign values to those variables. ** ** The first parameter is a virtual machine obtained from sqlite_compile(). ** The 2nd "idx" parameter determines which variable in the SQL statement ** to bind the value to. The left most '?' is 1. The 3rd parameter is ** the value to assign to that variable. The 4th parameter is the number ** of bytes in the value, including the terminating \000 for strings. ** Finally, the 5th "copy" parameter is TRUE if SQLite should make its ** own private copy of this value, or false if the space that the 3rd ** parameter points to will be unchanging and can be used directly by ** SQLite. ** ** Unbound variables are treated as having a value of NULL. To explicitly ** set a variable to NULL, call this routine with the 3rd parameter as a ** NULL pointer. ** ** If the 4th "len" parameter is -1, then strlen() is used to find the ** length. ** ** This routine can only be called immediately after sqlite_compile() ** or sqlite_reset() and before any calls to sqlite_step(). ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ int sqlite_bind(sqlite_vm*, int idx, const char *value, int len, int copy); /* ** This routine configures a callback function - the progress callback - that ** is invoked periodically during long running calls to sqlite_exec(), ** sqlite_step() and sqlite_get_table(). An example use for this API is to keep ** a GUI updated during a large query. ** ** The progress callback is invoked once for every N virtual machine opcodes, ** where N is the second argument to this function. The progress callback ** itself is identified by the third argument to this function. The fourth ** argument to this function is a void pointer passed to the progress callback ** function each time it is invoked. ** ** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results ** in less than N opcodes being executed, then the progress callback is not ** invoked. ** ** Calling this routine overwrites any previously installed progress callback. ** To remove the progress callback altogether, pass NULL as the third ** argument to this function. ** ** If the progress callback returns a result other than 0, then the current ** query is immediately terminated and any database changes rolled back. If the ** query was part of a larger transaction, then the transaction is not rolled ** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ void sqlite_progress_handler(sqlite*, int, int(*)(void*), void*); /* ** Register a callback function to be invoked whenever a new transaction ** is committed. The pArg argument is passed through to the callback. ** callback. If the callback function returns non-zero, then the commit ** is converted into a rollback. ** ** If another function was previously registered, its pArg value is returned. ** Otherwise NULL is returned. ** ** Registering a NULL function disables the callback. ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ void *sqlite_commit_hook(sqlite*, int(*)(void*), void*); /* ** Open an encrypted SQLite database. If pKey==0 or nKey==0, this routine ** is the same as sqlite_open(). ** ** The code to implement this API is not available in the public release ** of SQLite. */ sqlite *sqlite_open_encrypted( const char *zFilename, /* Name of the encrypted database */ const void *pKey, /* Pointer to the key */ int nKey, /* Number of bytes in the key */ int *pErrcode, /* Write error code here */ char **pzErrmsg /* Write error message here */ ); /* ** Change the key on an open database. If the current database is not ** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the ** database is decrypted. ** ** The code to implement this API is not available in the public release ** of SQLite. */ int sqlite_rekey( sqlite *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The new key */ ); /* ** Encode a binary buffer "in" of size n bytes so that it contains ** no instances of characters '\'' or '\000'. The output is ** null-terminated and can be used as a string value in an INSERT ** or UPDATE statement. Use sqlite_decode_binary() to convert the ** string back into its original binary. ** ** The result is written into a preallocated output buffer "out". ** "out" must be able to hold at least 2 +(257*n)/254 bytes. ** In other words, the output will be expanded by as much as 3 ** bytes for every 254 bytes of input plus 2 bytes of fixed overhead. ** (This is approximately 2 + 1.0118*n or about a 1.2% size increase.) ** ** The return value is the number of characters in the encoded ** string, excluding the "\000" terminator. ** ** If out==NULL then no output is generated but the routine still returns ** the number of characters that would have been generated if out had ** not been NULL. */ int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out); /* ** Decode the string "in" into binary data and write it into "out". ** This routine reverses the encoding created by sqlite_encode_binary(). ** The output will always be a few bytes less than the input. The number ** of bytes of output is returned. If the input is not a well-formed ** encoding, -1 is returned. ** ** The "in" and "out" parameters may point to the same buffer in order ** to decode a string in place. */ int sqlite_decode_binary(const unsigned char *in, unsigned char *out); #ifdef __cplusplus } /* End of the 'extern "C"' block */ #endif #endif /* _SQLITE_H_ */ sqlite-2.8.17/src/sqliteInt.h0000644000175000001440000016011310251063227015762 0ustar drhusers00000000000000/* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.220.2.2 2005/06/06 15:07:03 drh Exp $ */ #include "config.h" #include "sqlite.h" #include "hash.h" #include "parse.h" #include "btree.h" #include #include #include #include /* ** The maximum number of in-memory pages to use for the main database ** table and for temporary tables. */ #define MAX_PAGES 2000 #define TEMP_PAGES 500 /* ** If the following macro is set to 1, then NULL values are considered ** distinct for the SELECT DISTINCT statement and for UNION or EXCEPT ** compound queries. No other SQL database engine (among those tested) ** works this way except for OCELOT. But the SQL92 spec implies that ** this is how things should work. ** ** If the following macro is set to 0, then NULLs are indistinct for ** SELECT DISTINCT and for UNION. */ #define NULL_ALWAYS_DISTINCT 0 /* ** If the following macro is set to 1, then NULL values are considered ** distinct when determining whether or not two entries are the same ** in a UNIQUE index. This is the way PostgreSQL, Oracle, DB2, MySQL, ** OCELOT, and Firebird all work. The SQL92 spec explicitly says this ** is the way things are suppose to work. ** ** If the following macro is set to 0, the NULLs are indistinct for ** a UNIQUE index. In this mode, you can only have a single NULL entry ** for a column declared UNIQUE. This is the way Informix and SQL Server ** work. */ #define NULL_DISTINCT_FOR_UNIQUE 1 /* ** The maximum number of attached databases. This must be at least 2 ** in order to support the main database file (0) and the file used to ** hold temporary tables (1). And it must be less than 256 because ** an unsigned character is used to stored the database index. */ #define MAX_ATTACHED 10 /* ** The next macro is used to determine where TEMP tables and indices ** are stored. Possible values: ** ** 0 Always use a temporary files ** 1 Use a file unless overridden by "PRAGMA temp_store" ** 2 Use memory unless overridden by "PRAGMA temp_store" ** 3 Always use memory */ #ifndef TEMP_STORE # define TEMP_STORE 1 #endif /* ** When building SQLite for embedded systems where memory is scarce, ** you can define one or more of the following macros to omit extra ** features of the library and thus keep the size of the library to ** a minimum. */ /* #define SQLITE_OMIT_AUTHORIZATION 1 */ /* #define SQLITE_OMIT_INMEMORYDB 1 */ /* #define SQLITE_OMIT_VACUUM 1 */ /* #define SQLITE_OMIT_DATETIME_FUNCS 1 */ /* #define SQLITE_OMIT_PROGRESS_CALLBACK 1 */ /* ** Integers of known sizes. These typedefs might change for architectures ** where the sizes very. Preprocessor macros are available so that the ** types can be conveniently redefined at compile-type. Like this: ** ** cc '-DUINTPTR_TYPE=long long int' ... */ #ifndef UINT32_TYPE # define UINT32_TYPE unsigned int #endif #ifndef UINT16_TYPE # define UINT16_TYPE unsigned short int #endif #ifndef INT16_TYPE # define INT16_TYPE short int #endif #ifndef UINT8_TYPE # define UINT8_TYPE unsigned char #endif #ifndef INT8_TYPE # define INT8_TYPE signed char #endif #ifndef INTPTR_TYPE # 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 */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef UINT8_TYPE i8; /* 1-byte signed integer */ typedef INTPTR_TYPE ptr; /* Big enough to hold a pointer */ typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */ /* ** Defer sourcing vdbe.h until after the "u8" typedef is defined. */ #include "vdbe.h" /* ** Most C compilers these days recognize "long double", don't they? ** Just in case we encounter one that does not, we will create a macro ** for long double so that it can be easily changed to just "double". */ #ifndef LONGDOUBLE_TYPE # define LONGDOUBLE_TYPE long double #endif /* ** This macro casts a pointer to an integer. Useful for doing ** pointer arithmetic. */ #define Addr(X) ((uptr)X) /* ** The maximum number of bytes of data that can be put into a single ** row of a single table. The upper bound on this limit is 16777215 ** bytes (or 16MB-1). We have arbitrarily set the limit to just 1MB ** here because the overflow page chain is inefficient for really big ** records and we want to discourage people from thinking that ** multi-megabyte records are OK. If your needs are different, you can ** change this define and recompile to increase or decrease the record ** size. ** ** The 16777198 is computed as follows: 238 bytes of payload on the ** original pages plus 16448 overflow pages each holding 1020 bytes of ** data. */ #define MAX_BYTES_PER_ROW 1048576 /* #define MAX_BYTES_PER_ROW 16777198 */ /* ** If memory allocation problems are found, recompile with ** ** -DMEMORY_DEBUG=1 ** ** to enable some sanity checking on malloc() and free(). To ** check for memory leaks, recompile with ** ** -DMEMORY_DEBUG=2 ** ** and a line of text will be written to standard error for ** each malloc() and free(). This output can be analyzed ** by an AWK script to determine if there are any leaks. */ #ifdef MEMORY_DEBUG # define sqliteMalloc(X) sqliteMalloc_(X,1,__FILE__,__LINE__) # define sqliteMallocRaw(X) sqliteMalloc_(X,0,__FILE__,__LINE__) # define sqliteFree(X) sqliteFree_(X,__FILE__,__LINE__) # define sqliteRealloc(X,Y) sqliteRealloc_(X,Y,__FILE__,__LINE__) # define sqliteStrDup(X) sqliteStrDup_(X,__FILE__,__LINE__) # define sqliteStrNDup(X,Y) sqliteStrNDup_(X,Y,__FILE__,__LINE__) void sqliteStrRealloc(char**); #else # define sqliteRealloc_(X,Y) sqliteRealloc(X,Y) # define sqliteStrRealloc(X) #endif /* ** This variable gets set if malloc() ever fails. After it gets set, ** the SQLite library shuts down permanently. */ extern int sqlite_malloc_failed; /* ** The following global variables are used for testing and debugging ** only. They only work if MEMORY_DEBUG is defined. */ #ifdef MEMORY_DEBUG extern int sqlite_nMalloc; /* Number of sqliteMalloc() calls */ extern int sqlite_nFree; /* Number of sqliteFree() calls */ extern int sqlite_iMallocFail; /* Fail sqliteMalloc() after this many calls */ #endif /* ** Name of the master database table. The master database table ** is a special table that holds the names and attributes of all ** user tables and indices. */ #define MASTER_NAME "sqlite_master" #define TEMP_MASTER_NAME "sqlite_temp_master" /* ** The name of the schema table. */ #define SCHEMA_TABLE(x) (x?TEMP_MASTER_NAME:MASTER_NAME) /* ** A convenience macro that returns the number of elements in ** an array. */ #define ArraySize(X) (sizeof(X)/sizeof(X[0])) /* ** Forward references to structures */ typedef struct Column Column; typedef struct Table Table; typedef struct Index Index; typedef struct Instruction Instruction; typedef struct Expr Expr; typedef struct ExprList ExprList; typedef struct Parse Parse; typedef struct Token Token; typedef struct IdList IdList; typedef struct SrcList SrcList; typedef struct WhereInfo WhereInfo; typedef struct WhereLevel WhereLevel; typedef struct Select Select; typedef struct AggExpr AggExpr; typedef struct FuncDef FuncDef; typedef struct Trigger Trigger; typedef struct TriggerStep TriggerStep; typedef struct TriggerStack TriggerStack; typedef struct FKey FKey; typedef struct Db Db; typedef struct AuthContext AuthContext; /* ** Each database file to be accessed by the system is an instance ** of the following structure. There are normally two of these structures ** in the sqlite.aDb[] array. aDb[0] is the main database file and ** aDb[1] is the database file used to hold temporary tables. Additional ** databases may be attached. */ struct Db { char *zName; /* Name of this database */ Btree *pBt; /* The B*Tree structure for this database file */ int schema_cookie; /* Database schema version number for this file */ Hash tblHash; /* All tables indexed by name */ Hash idxHash; /* All (named) indices indexed by name */ Hash trigHash; /* All triggers indexed by name */ Hash aFKey; /* Foreign keys indexed by to-table */ u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ u16 flags; /* Flags associated with this database */ void *pAux; /* Auxiliary data. Usually NULL */ void (*xFreeAux)(void*); /* Routine to free pAux */ }; /* ** These macros can be used to test, set, or clear bits in the ** Db.flags field. */ #define DbHasProperty(D,I,P) (((D)->aDb[I].flags&(P))==(P)) #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].flags&(P))!=0) #define DbSetProperty(D,I,P) (D)->aDb[I].flags|=(P) #define DbClearProperty(D,I,P) (D)->aDb[I].flags&=~(P) /* ** Allowed values for the DB.flags field. ** ** The DB_Locked flag is set when the first OP_Transaction or OP_Checkpoint ** opcode is emitted for a database. This prevents multiple occurances ** of those opcodes for the same database in the same program. Similarly, ** the DB_Cookie flag is set when the OP_VerifyCookie opcode is emitted, ** and prevents duplicate OP_VerifyCookies from taking up space and slowing ** down execution. ** ** The DB_SchemaLoaded flag is set after the database schema has been ** read into internal hash tables. ** ** DB_UnresetViews means that one or more views have column names that ** have been filled out. If the schema changes, these column names might ** changes and so the view will need to be reset. */ #define DB_Locked 0x0001 /* OP_Transaction opcode has been emitted */ #define DB_Cookie 0x0002 /* OP_VerifyCookie opcode has been emiited */ #define DB_SchemaLoaded 0x0004 /* The schema has been loaded */ #define DB_UnresetViews 0x0008 /* Some views have defined column names */ /* ** Each database is an instance of the following structure. ** ** The sqlite.file_format is initialized by the database file ** and helps determines how the data in the database file is ** represented. This field allows newer versions of the library ** to read and write older databases. The various file formats ** are as follows: ** ** file_format==1 Version 2.1.0. ** file_format==2 Version 2.2.0. Add support for INTEGER PRIMARY KEY. ** file_format==3 Version 2.6.0. Fix empty-string index bug. ** file_format==4 Version 2.7.0. Add support for separate numeric and ** text datatypes. ** ** The sqlite.temp_store determines where temporary database files ** are stored. If 1, then a file is created to hold those tables. If ** 2, then they are held in memory. 0 means use the default value in ** the TEMP_STORE macro. ** ** The sqlite.lastRowid records the last insert rowid generated by an ** insert statement. Inserts on views do not affect its value. Each ** trigger has its own context, so that lastRowid can be updated inside ** triggers as usual. The previous value will be restored once the trigger ** exits. Upon entering a before or instead of trigger, lastRowid is no ** longer (since after version 2.8.12) reset to -1. ** ** The sqlite.nChange does not count changes within triggers and keeps no ** context. It is reset at start of sqlite_exec. ** The sqlite.lsChange represents the number of changes made by the last ** insert, update, or delete statement. It remains constant throughout the ** length of a statement and is then updated by OP_SetCounts. It keeps a ** context stack just like lastRowid so that the count of changes ** within a trigger is not seen outside the trigger. Changes to views do not ** affect the value of lsChange. ** The sqlite.csChange keeps track of the number of current changes (since ** the last statement) and is used to update sqlite_lsChange. */ struct sqlite { int nDb; /* Number of backends currently in use */ Db *aDb; /* All backends */ Db aDbStatic[2]; /* Static space for the 2 default backends */ int flags; /* Miscellanous flags. See below */ u8 file_format; /* What file format version is this database? */ u8 safety_level; /* How aggressive at synching data to disk */ u8 want_to_close; /* Close after all VDBEs are deallocated */ u8 temp_store; /* 1=file, 2=memory, 0=compile-time default */ u8 onError; /* Default conflict algorithm */ int next_cookie; /* Next value of aDb[0].schema_cookie */ int cache_size; /* Number of pages to use in the cache */ int nTable; /* Number of tables in the database */ void *pBusyArg; /* 1st Argument to the busy callback */ int (*xBusyCallback)(void *,const char*,int); /* The busy callback */ void *pCommitArg; /* Argument to xCommitCallback() */ int (*xCommitCallback)(void*);/* Invoked at every commit. */ Hash aFunc; /* All functions that can be in SQL exprs */ int lastRowid; /* ROWID of most recent insert (see above) */ int priorNewRowid; /* Last randomly generated ROWID */ int magic; /* Magic number for detect library misuse */ int nChange; /* Number of rows changed (see above) */ int lsChange; /* Last statement change count (see above) */ int csChange; /* Current statement change count (see above) */ struct sqliteInitInfo { /* Information used during initialization */ int iDb; /* When back is being initialized */ int newTnum; /* Rootpage of table being initialized */ u8 busy; /* TRUE if currently initializing */ } init; struct Vdbe *pVdbe; /* List of active virtual machines */ void (*xTrace)(void*,const char*); /* Trace function */ void *pTraceArg; /* Argument to the trace function */ #ifndef SQLITE_OMIT_AUTHORIZATION int (*xAuth)(void*,int,const char*,const char*,const char*,const char*); /* Access authorization function */ void *pAuthArg; /* 1st argument to the access auth function */ #endif #ifndef SQLITE_OMIT_PROGRESS_CALLBACK int (*xProgress)(void *); /* The progress callback */ void *pProgressArg; /* Argument to the progress callback */ int nProgressOps; /* Number of opcodes for progress callback */ #endif }; /* ** Possible values for the sqlite.flags and or Db.flags fields. ** ** On sqlite.flags, the SQLITE_InTrans value means that we have ** executed a BEGIN. On Db.flags, SQLITE_InTrans means a statement ** transaction is active on that particular database file. */ #define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */ #define SQLITE_Initialized 0x00000002 /* True after initialization */ #define SQLITE_Interrupt 0x00000004 /* Cancel current operation */ #define SQLITE_InTrans 0x00000008 /* True if in a transaction */ #define SQLITE_InternChanges 0x00000010 /* Uncommitted Hash table changes */ #define SQLITE_FullColNames 0x00000020 /* Show full column names on SELECT */ #define SQLITE_ShortColNames 0x00000040 /* Show short columns names */ #define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */ /* DELETE, or UPDATE and return */ /* the count using a callback. */ #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ /* result set is empty */ #define SQLITE_ReportTypes 0x00000200 /* Include information on datatypes */ /* in 4th argument of callback */ /* ** Possible values for the sqlite.magic field. ** The numbers are obtained at random and have no special meaning, other ** than being distinct from one another. */ #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ #define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */ #define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */ #define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */ /* ** Each SQL function is defined by an instance of the following ** structure. A pointer to this structure is stored in the sqlite.aFunc ** hash table. When multiple functions have the same name, the hash table ** points to a linked list of these structures. */ struct FuncDef { void (*xFunc)(sqlite_func*,int,const char**); /* Regular function */ void (*xStep)(sqlite_func*,int,const char**); /* Aggregate function step */ void (*xFinalize)(sqlite_func*); /* Aggregate function finializer */ signed char nArg; /* Number of arguments. -1 means unlimited */ signed char dataType; /* Arg that determines datatype. -1=NUMERIC, */ /* -2=TEXT. -3=SQLITE_ARGS */ u8 includeTypes; /* Add datatypes to args of xFunc and xStep */ void *pUserData; /* User data parameter */ FuncDef *pNext; /* Next function with same name */ }; /* ** information about each column of an SQL table is held in an instance ** of this structure. */ struct Column { char *zName; /* Name of this column */ char *zDflt; /* Default value of this column */ char *zType; /* Data type for this column */ u8 notNull; /* True if there is a NOT NULL constraint */ u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */ u8 sortOrder; /* Some combination of SQLITE_SO_... values */ u8 dottedName; /* True if zName contains a "." character */ }; /* ** The allowed sort orders. ** ** The TEXT and NUM values use bits that do not overlap with DESC and ASC. ** That way the two can be combined into a single number. */ #define SQLITE_SO_UNK 0 /* Use the default collating type. (SCT_NUM) */ #define SQLITE_SO_TEXT 2 /* Sort using memcmp() */ #define SQLITE_SO_NUM 4 /* Sort using sqliteCompare() */ #define SQLITE_SO_TYPEMASK 6 /* Mask to extract the collating sequence */ #define SQLITE_SO_ASC 0 /* Sort in ascending order */ #define SQLITE_SO_DESC 1 /* Sort in descending order */ #define SQLITE_SO_DIRMASK 1 /* Mask to extract the sort direction */ /* ** Each SQL table is represented in memory by an instance of the ** following structure. ** ** Table.zName is the name of the table. The case of the original ** CREATE TABLE statement is stored, but case is not significant for ** comparisons. ** ** Table.nCol is the number of columns in this table. Table.aCol is a ** pointer to an array of Column structures, one for each column. ** ** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of ** the column that is that key. Otherwise Table.iPKey is negative. Note ** that the datatype of the PRIMARY KEY must be INTEGER for this field to ** be set. An INTEGER PRIMARY KEY is used as the rowid for each row of ** the table. If a table has no INTEGER PRIMARY KEY, then a random rowid ** is generated for each row of the table. Table.hasPrimKey is true if ** the table has any PRIMARY KEY, INTEGER or otherwise. ** ** Table.tnum is the page number for the root BTree page of the table in the ** database file. If Table.iDb is the index of the database table backend ** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that ** holds temporary tables and indices. If Table.isTransient ** is true, then the table is stored in a file that is automatically deleted ** when the VDBE cursor to the table is closed. In this case Table.tnum ** refers VDBE cursor number that holds the table open, not to the root ** page number. Transient tables are used to hold the results of a ** sub-query that appears instead of a real table name in the FROM clause ** of a SELECT statement. */ struct Table { char *zName; /* Name of the table */ int nCol; /* Number of columns in this table */ Column *aCol; /* Information about each column */ int iPKey; /* If not less then 0, use aCol[iPKey] as the primary key */ Index *pIndex; /* List of SQL indexes on this table. */ int tnum; /* Root BTree node for this table (see note above) */ Select *pSelect; /* NULL for tables. Points to definition if a view. */ u8 readOnly; /* True if this table should not be written by the user */ u8 iDb; /* Index into sqlite.aDb[] of the backend for this table */ u8 isTransient; /* True if automatically deleted when VDBE finishes */ u8 hasPrimKey; /* True if there exists a primary key */ u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ Trigger *pTrigger; /* List of SQL triggers on this table */ FKey *pFKey; /* Linked list of all foreign keys in this table */ }; /* ** Each foreign key constraint is an instance of the following structure. ** ** A foreign key is associated with two tables. The "from" table is ** the table that contains the REFERENCES clause that creates the foreign ** key. The "to" table is the table that is named in the REFERENCES clause. ** Consider this example: ** ** CREATE TABLE ex1( ** a INTEGER PRIMARY KEY, ** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) ** ); ** ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". ** ** Each REFERENCES clause generates an instance of the following structure ** which is attached to the from-table. The to-table need not exist when ** the from-table is created. The existance of the to-table is not checked ** until an attempt is made to insert data into the from-table. ** ** The sqlite.aFKey hash table stores pointers to this structure ** given the name of a to-table. For each to-table, all foreign keys ** associated with that table are on a linked list using the FKey.pNextTo ** field. */ struct FKey { Table *pFrom; /* The table that constains the REFERENCES clause */ FKey *pNextFrom; /* Next foreign key in pFrom */ char *zTo; /* Name of table that the key points to */ FKey *pNextTo; /* Next foreign key that points to zTo */ int nCol; /* Number of columns in this key */ struct sColMap { /* Mapping of columns in pFrom to columns in zTo */ int iFrom; /* Index of column in pFrom */ char *zCol; /* Name of column in zTo. If 0 use PRIMARY KEY */ } *aCol; /* One entry for each of nCol column s */ u8 isDeferred; /* True if constraint checking is deferred till COMMIT */ u8 updateConf; /* How to resolve conflicts that occur on UPDATE */ u8 deleteConf; /* How to resolve conflicts that occur on DELETE */ u8 insertConf; /* How to resolve conflicts that occur on INSERT */ }; /* ** SQLite supports many different ways to resolve a contraint ** error. ROLLBACK processing means that a constraint violation ** causes the operation in process to fail and for the current transaction ** to be rolled back. ABORT processing means the operation in process ** fails and any prior changes from that one operation are backed out, ** but the transaction is not rolled back. FAIL processing means that ** the operation in progress stops and returns an error code. But prior ** changes due to the same operation are not backed out and no rollback ** occurs. IGNORE means that the particular row that caused the constraint ** error is not inserted or updated. Processing continues and no error ** is returned. REPLACE means that preexisting database rows that caused ** a UNIQUE constraint violation are removed so that the new insert or ** update can proceed. Processing continues and no error is reported. ** ** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys. ** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the ** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign ** key is set to NULL. CASCADE means that a DELETE or UPDATE of the ** referenced table row is propagated into the row that holds the ** foreign key. ** ** The following symbolic values are used to record which type ** of action to take. */ #define OE_None 0 /* There is no constraint to check */ #define OE_Rollback 1 /* Fail the operation and rollback the transaction */ #define OE_Abort 2 /* Back out changes but do no rollback transaction */ #define OE_Fail 3 /* Stop the operation but leave all prior changes */ #define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */ #define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */ #define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */ #define OE_SetNull 7 /* Set the foreign key value to NULL */ #define OE_SetDflt 8 /* Set the foreign key value to its default */ #define OE_Cascade 9 /* Cascade the changes */ #define OE_Default 99 /* Do whatever the default action is */ /* ** Each SQL index is represented in memory by an ** instance of the following structure. ** ** The columns of the table that are to be indexed are described ** by the aiColumn[] field of this structure. For example, suppose ** we have the following table and index: ** ** CREATE TABLE Ex1(c1 int, c2 int, c3 text); ** CREATE INDEX Ex2 ON Ex1(c3,c1); ** ** In the Table structure describing Ex1, nCol==3 because there are ** three columns in the table. In the Index structure describing ** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed. ** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the ** first column to be indexed (c3) has an index of 2 in Ex1.aCol[]. ** The second column to be indexed (c1) has an index of 0 in ** Ex1.aCol[], hence Ex2.aiColumn[1]==0. ** ** The Index.onError field determines whether or not the indexed columns ** must be unique and what to do if they are not. When Index.onError=OE_None, ** it means this is not a unique index. Otherwise it is a unique index ** and the value of Index.onError indicate the which conflict resolution ** algorithm to employ whenever an attempt is made to insert a non-unique ** element. */ struct Index { char *zName; /* Name of this index */ int nColumn; /* Number of columns in the table used by this index */ int *aiColumn; /* Which columns are used by this index. 1st is 0 */ Table *pTable; /* The SQL table being indexed */ int tnum; /* Page containing root of this index in database file */ u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */ u8 iDb; /* Index in sqlite.aDb[] of where this index is stored */ Index *pNext; /* The next index associated with the same table */ }; /* ** Each token coming out of the lexer is an instance of ** this structure. Tokens are also used as part of an expression. ** ** Note if Token.z==0 then Token.dyn and Token.n are undefined and ** may contain random values. Do not make any assuptions about Token.dyn ** and Token.n when Token.z==0. */ struct Token { const char *z; /* Text of the token. Not NULL-terminated! */ unsigned dyn : 1; /* True for malloced memory, false for static */ unsigned n : 31; /* Number of characters in this token */ }; /* ** Each node of an expression in the parse tree is an instance ** of this structure. ** ** Expr.op is the opcode. The integer parser token codes are reused ** as opcodes here. For example, the parser defines TK_GE to be an integer ** code representing the ">=" operator. This same integer code is reused ** to represent the greater-than-or-equal-to operator in the expression ** tree. ** ** Expr.pRight and Expr.pLeft are subexpressions. Expr.pList is a list ** of argument if the expression is a function. ** ** Expr.token is the operator token for this node. For some expressions ** that have subexpressions, Expr.token can be the complete text that gave ** rise to the Expr. In the latter case, the token is marked as being ** a compound token. ** ** An expression of the form ID or ID.ID refers to a column in a table. ** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is ** the integer cursor number of a VDBE cursor pointing to that table and ** Expr.iColumn is the column number for the specific column. If the ** expression is used as a result in an aggregate SELECT, then the ** value is also stored in the Expr.iAgg column in the aggregate so that ** it can be accessed after all aggregates are computed. ** ** If the expression is a function, the Expr.iTable is an integer code ** representing which function. If the expression is an unbound variable ** marker (a question mark character '?' in the original SQL) then the ** Expr.iTable holds the index number for that variable. ** ** The Expr.pSelect field points to a SELECT statement. The SELECT might ** be the right operand of an IN operator. Or, if a scalar SELECT appears ** in an expression the opcode is TK_SELECT and Expr.pSelect is the only ** operand. */ struct Expr { u8 op; /* Operation performed by this node */ u8 dataType; /* Either SQLITE_SO_TEXT or SQLITE_SO_NUM */ u8 iDb; /* Database referenced by this expression */ u8 flags; /* Various flags. See below */ Expr *pLeft, *pRight; /* Left and right subnodes */ ExprList *pList; /* A list of expressions used as function arguments ** or in " IN (useAgg==TRUE, pull ** result from the iAgg-th element of the aggregator */ Select *pSelect; /* When the expression is a sub-select. Also the ** right side of " IN (]* [ORDER BY ] [LIMIT [LP OFFSET | , RP ]] } {result} { [, ]* } {result-column} { STAR | . STAR | [ [AS] ] } {table-list} { [
]* } {table} { [AS ] | (
'keyword' Interpreted as a literal string if it occurs in a legal string context, otherwise as an identifier.
"keyword" Interpreted as an identifier if it matches a known identifier and occurs in a legal identifier context, otherwise as a string.
[keyword] Always interpreted as an identifer. (This notation is used by MS Access and SQL Server.)

Fallback Keywords

These keywords can be used as identifiers for SQLite objects without delimiters.

} proc keyword_list {x} { puts "

" foreach k $x { if {[string index $k 0]=="*"} { set nonstandard 1 set k [string range $k 1 end] } else { set nonstandard 0 } if {$nonstandard} { puts "$k   " } else { puts "$k   " } } puts "

\n" } keyword_list { *ABORT AFTER ASC *ATTACH BEFORE BEGIN DEFERRED CASCADE *CLUSTER *CONFLICT *COPY CROSS *DATABASE *DELIMITERS DESC *DETACH EACH END *EXPLAIN *FAIL FOR FULL IGNORE IMMEDIATE INITIALLY INNER *INSTEAD KEY LEFT MATCH NATURAL OF *OFFSET OUTER *PRAGMA *RAISE *REPLACE RESTRICT RIGHT *ROW *STATEMENT *TEMP TEMPORARY TRIGGER *VACUUM VIEW } puts {

Normal keywords

These keywords can be used as identifiers for SQLite objects, but must be enclosed in brackets or quotes for SQLite to recognize them as an identifier.

} keyword_list { ALL AND AS BETWEEN BY CASE CHECK COLLATE COMMIT CONSTRAINT CREATE DEFAULT DEFERRABLE DELETE DISTINCT DROP ELSE EXCEPT FOREIGN FROM *GLOB GROUP HAVING IN *INDEX INSERT INTERSECT INTO IS *ISNULL JOIN LIKE LIMIT NOT *NOTNULL NULL ON OR ORDER PRIMARY REFERENCES ROLLBACK SELECT SET TABLE THEN TRANSACTION UNION UNIQUE UPDATE USING VALUES WHEN WHERE } puts {

Special words

The following are not keywords in SQLite, but are used as names of system objects. They can be used as an identifier for a different type of object.

} keyword_list { *_ROWID_ *MAIN OID *ROWID *SQLITE_MASTER *SQLITE_TEMP_MASTER } puts {


Back to the SQLite Home Page

} sqlite-2.8.17/www/nulls.tcl0000644000175000001440000003247710232547612015552 0ustar drhusers00000000000000# # Run this script to generated a nulls.html output file # set rcsid {$Id: nulls.tcl,v 1.5 2003/11/08 12:07:01 drh Exp $} puts { NULL Handling In SQLite Versus Other Database Engines

NULL Handling in SQLite Versus Other Database Engines

} puts "

(This page was last modified on [lrange $rcsid 3 4] UTC)

" puts {

The goal is to make SQLite handle NULLs in a standards-compliant way. But the descriptions in the SQL standards on how to handle NULLs seem ambiguous. It is not clear from the standards documents exactly how NULLs should be handled in all circumstances.

So instead of going by the standards documents, various popular SQL engines were tested to see how they handle NULLs. The idea was to make SQLite work like all the other engines. A SQL test script was developed and run by volunteers on various SQL RDBMSes and the results of those tests were used to deduce how each engine processed NULL values. The original tests were run in May of 2002. A copy of the test script is found at the end of this document.

SQLite was originally coded in such a way that the answer to all questions in the chart below would be "Yes". But the expriments run on other SQL engines showed that none of them worked this way. So SQLite was modified to work the same as Oracle, PostgreSQL, and DB2. This involved making NULLs indistinct for the purposes of the SELECT DISTINCT statement and for the UNION operator in a SELECT. NULLs are still distinct in a UNIQUE column. This seems somewhat arbitrary, but the desire to be compatible with other engines outweighted that objection.

It is possible to make SQLite treat NULLs as distinct for the purposes of the SELECT DISTINCT and UNION. To do so, one should change the value of the NULL_ALWAYS_DISTINCT #define in the sqliteInt.h source file and recompile.

Update 2003-07-13: Since this document was originally written some of the database engines tested have been updated and users have been kind enough to send in corrections to the chart below. The original data showed a wide variety of behaviors, but over time the range of behaviors has converged toward the PostgreSQL/Oracle model. The only significant difference is that Informix and MS-SQL both threat NULLs as indistinct in a UNIQUE column.

The fact that NULLs are distinct for UNIQUE columns but are indistinct for SELECT DISTINCT and UNION continues to be puzzling. It seems that NULLs should be either distinct everywhere or nowhere. And the SQL standards documents suggest that NULLs should be distinct everywhere. Yet as of this writing, no SQL engine tested treats NULLs as distinct in a SELECT DISTINCT statement or in a UNION.

The following table shows the results of the NULL handling experiments.

   SQLite PostgreSQL Oracle Informix DB2 MS-SQL OCELOT
Adding anything to null gives null Yes Yes Yes Yes Yes Yes Yes
Multiplying null by zero gives null Yes Yes Yes Yes Yes Yes Yes
nulls are distinct in a UNIQUE column Yes Yes Yes No Yes No Yes
nulls are distinct in SELECT DISTINCT No No No No No No No
nulls are distinct in a UNION No No No No No No No
"CASE WHEN null THEN 1 ELSE 0 END" is 0? Yes Yes Yes Yes Yes Yes Yes
"null OR true" is true Yes Yes Yes Yes Yes Yes Yes
"not (null AND false)" is true Yes Yes Yes Yes Yes Yes Yes
   MySQL
3.23.41
MySQL
4.0.16
Firebird SQL
Anywhere
Borland
Interbase
Adding anything to null gives null Yes Yes Yes Yes Yes
Multiplying null by zero gives null Yes Yes Yes Yes Yes
nulls are distinct in a UNIQUE column Yes Yes Yes (Note 4) (Note 4)
nulls are distinct in SELECT DISTINCT No No No (Note 1) No No
nulls are distinct in a UNION (Note 3) No No (Note 1) No No
"CASE WHEN null THEN 1 ELSE 0 END" is 0? Yes Yes Yes Yes (Note 5)
"null OR true" is true Yes Yes Yes Yes Yes
"not (null AND false)" is true No Yes Yes Yes Yes
Notes:   1.  Older versions of firebird omits all NULLs from SELECT DISTINCT and from UNION.
2.  Test data unavailable.
3.  MySQL version 3.23.41 does not support UNION.
4.  SQL Anywhere and Borland Interbase do not allow NULLs in a UNIQUE column.
5.  Borland Interbase does not support CASE expressions.

 

The following script was used to gather information for the table above.

-- I have about decided that SQL's treatment of NULLs is capricious and cannot be
-- deduced by logic.  It must be discovered by experiment.  To that end, I have 
-- prepared the following script to test how various SQL databases deal with NULL.
-- My aim is to use the information gather from this script to make SQLite as much
-- like other databases as possible.
--
-- If you could please run this script in your database engine and mail the results
-- to me at drh@hwaci.com, that will be a big help.  Please be sure to identify the
-- database engine you use for this test.  Thanks.
--
-- If you have to change anything to get this script to run with your database
-- engine, please send your revised script together with your results.
--

-- Create a test table with data
create table t1(a int, b int, c int);
insert into t1 values(1,0,0);
insert into t1 values(2,0,1);
insert into t1 values(3,1,0);
insert into t1 values(4,1,1);
insert into t1 values(5,null,0);
insert into t1 values(6,null,1);
insert into t1 values(7,null,null);

-- Check to see what CASE does with NULLs in its test expressions
select a, case when b<>0 then 1 else 0 end from t1;
select a+10, case when not b<>0 then 1 else 0 end from t1;
select a+20, case when b<>0 and c<>0 then 1 else 0 end from t1;
select a+30, case when not (b<>0 and c<>0) then 1 else 0 end from t1;
select a+40, case when b<>0 or c<>0 then 1 else 0 end from t1;
select a+50, case when not (b<>0 or c<>0) then 1 else 0 end from t1;
select a+60, case b when c then 1 else 0 end from t1;
select a+70, case c when b then 1 else 0 end from t1;

-- What happens when you multiple a NULL by zero?
select a+80, b*0 from t1;
select a+90, b*c from t1;

-- What happens to NULL for other operators?
select a+100, b+c from t1;

-- Test the treatment of aggregate operators
select count(*), count(b), sum(b), avg(b), min(b), max(b) from t1;

-- Check the behavior of NULLs in WHERE clauses
select a+110 from t1 where b<10;
select a+120 from t1 where not b>10;
select a+130 from t1 where b<10 OR c=1;
select a+140 from t1 where b<10 AND c=1;
select a+150 from t1 where not (b<10 AND c=1);
select a+160 from t1 where not (c=1 AND b<10);

-- Check the behavior of NULLs in a DISTINCT query
select distinct b from t1;

-- Check the behavior of NULLs in a UNION query
select b from t1 union select b from t1;

-- Create a new table with a unique column.  Check to see if NULLs are considered
-- to be distinct.
create table t2(a int, b int unique);
insert into t2 values(1,1);
insert into t2 values(2,null);
insert into t2 values(3,null);
select * from t2;

drop table t1;
drop table t2;


Back to the SQLite Home Page

} sqlite-2.8.17/www/download.tcl0000644000175000001440000000576010232547612016217 0ustar drhusers00000000000000# # Run this TCL script to generate HTML for the download.html file. # set rcsid {$Id: download.tcl,v 1.6 2002/08/15 13:45:17 drh Exp $} puts { SQLite Download Page

SQLite Download Page

} proc Product {file desc} { if {![file exists $file]} return set size [file size $file] puts [subst { }] } proc Heading {title} { puts "" } Heading {Precompiled Binaries for Linux} Product sqlite.bin.gz { A command-line program for accessing and modifing SQLite databases. See the documentation for additional information. } Product tclsqlite.so.gz { Bindings for TCL. You can import this shared library into either tclsh or wish to get SQLite database access from Tcl/Tk. See the documentation for details. } Product sqlite.so.gz { A precompiled shared-library for Linux. This is the same as tclsqlite.so.gz but without the TCL bindings. } foreach name [lsort -dict [glob -nocomplain sqlite-*.i386.rpm]] { if {[regexp -- -devel- $name]} { Product $name { RPM containing documentation, header files, and static library. } } else { Product $name { RPM containing shared libraries and the sqlite command-line program. } } } Heading {Precompiled Binaries For Windows} Product sqlite.zip { A command-line program for accessing and modifing SQLite databases. See the documentation for additional information. } Product tclsqlite.zip { Bindings for TCL. You can import this shared library into either tclsh or wish to get SQLite database access from Tcl/Tk. See the documentation for details. } Product sqlitedll.zip { This is a DLL of the SQLite library without the TCL bindings. The only external dependency is MSVCRT.DLL. } Heading {Source Code} Product {sqlite_source.zip} { This ZIP archive contains pure C source code for the SQLite library. Unlike the tarballs below, all of the preprocessing has already been done on these C source code, so you can just hand the files directly to your favorite C compiler. This file is provided as a service to MS-Windows users who lack the build support infrastructure of Unix. } foreach name [lsort -dict [glob -nocomplain sqlite-*.src.rpm]] { Product $name "RPM containing complete source code" } foreach name [lsort -dict -decreasing [glob -nocomplain sqlite-*.tar.gz]] { regexp {sqlite-(.*)\.tar\.gz} $name match vers Product $name " Version $vers of the source tree including all documentation. " } puts {
$file
($size bytes)
[string trim $desc]
$title


Back to the SQLite home page

} sqlite-2.8.17/www/tclsqlite.tcl0000644000175000001440000002046410232547612016412 0ustar drhusers00000000000000# # Run this Tcl script to generate the tclsqlite.html file. # set rcsid {$Id: tclsqlite.tcl,v 1.8 2003/08/19 14:31:02 drh Exp $} puts { The Tcl interface to the SQLite library

The Tcl interface to the SQLite library

} puts "

(This page was last modified on [lrange $rcsid 3 4] UTC)

" puts {

The SQLite library is designed to be very easy to use from a Tcl or Tcl/Tk script. This document gives an overview of the Tcl programming interface.

The API

The interface to the SQLite library consists of single tcl command named sqlite. Because there is only this one interface command, the interface is not placed in a separate namespace.

The sqlite command is used as follows:

sqlite  dbcmd  database-name

The sqlite command opens the database named in the second argument. If the database does not already exist, it is automatically created. The sqlite command also creates a new Tcl command to control the database. The name of the new Tcl command is given by the first argument. This approach is similar to the way widgets are created in Tk.

The name of the database is just the name of a disk file in which the database is stored.

Once an SQLite database is open, it can be controlled using methods of the dbcmd. There are currently 7 methods defined:

  • busy
  • changes
  • close
  • complete
  • eval
  • last_insert_rowid
  • onecolumn
  • timeout

We will explain all of these methods, though not in that order. We will be begin with the "close" method.

The "close" method

As its name suggests, the "close" method to an SQLite database just closes the database. This has the side-effect of deleting the dbcmd Tcl command. Here is an example of opening and then immediately closing a database:

sqlite db1 ./testdb
db1 close

If you delete the dbcmd directly, that has the same effect as invoking the "close" method. So the following code is equivalent to the previous:

sqlite db1 ./testdb
rename db1 {}

The "eval" method

The most useful dbcmd method is "eval". The eval method is used to execute SQL on the database. The syntax of the eval method looks like this:

dbcmd  eval  sql   ?array-name  script?

The job of the eval method is to execute the SQL statement or statements given in the second argument. For example, to create a new table in a database, you can do this:

sqlite db1 ./testdb
db1 eval {CREATE TABLE t1(a int, b text)}

The above code creates a new table named t1 with columns a and b. What could be simpler?

Query results are returned as a list of column values. If a query requests 2 columns and there are 3 rows matching the query, then the returned list will contain 6 elements. For example:

db1 eval {INSERT INTO t1 VALUES(1,'hello')}
db1 eval {INSERT INTO t1 VALUES(2,'goodbye')}
db1 eval {INSERT INTO t1 VALUES(3,'howdy!')}
set x [db1 eval {SELECT * FROM t1 ORDER BY a}]

The variable $x is set by the above code to

1 hello 2 goodbye 3 howdy!

You can also process the results of a query one row at a time by specifying the name of an array variable and a script following the SQL code. For each row of the query result, the value of each column will be inserted into the array variable and the script will be executed. For instance:

db1 eval {SELECT * FROM t1 ORDER BY a} values {
    parray values
    puts ""
}

This last code will give the following output:

values(*) = a b
values(a) = 1
values(b) = hello

values(*) = a b
values(a) = 2
values(b) = goodbye

values(*) = a b
values(a) = 3
values(b) = howdy!

For each column in a row of the result, the name of that column is used as an index in to array. The value of the column is stored in the corresponding array entry. The special array index * is used to store a list of column names in the order that they appear.

If the array variable name is the empty string, then the value of each column is stored in a variable with the same name as the column itself. For example:

db1 eval {SELECT * FROM t1 ORDER BY a} {} {
    puts "a=$a b=$b"
}

From this we get the following output

a=1 b=hello
a=2 b=goodbye
a=3 b=howdy!

The "complete" method

The "complete" method takes a string of supposed SQL as its only argument. It returns TRUE if the string is a complete statement of SQL and FALSE if there is more to be entered.

The "complete" method is useful when building interactive applications in order to know when the user has finished entering a line of SQL code. This is really just an interface to the sqlite_complete() C function. Refer to the C/C++ interface specification for additional information.

The "timeout" method

The "timeout" method is used to control how long the SQLite library will wait for locks to clear before giving up on a database transaction. The default timeout is 0 millisecond. (In other words, the default behavior is not to wait at all.)

The SQlite database allows multiple simultaneous readers or a single writer but not both. If any process is writing to the database no other process is allows to read or write. If any process is reading the database other processes are allowed to read but not write. The entire database shared a single lock.

When SQLite tries to open a database and finds that it is locked, it can optionally delay for a short while and try to open the file again. This process repeats until the query times out and SQLite returns a failure. The timeout is adjustable. It is set to 0 by default so that if the database is locked, the SQL statement fails immediately. But you can use the "timeout" method to change the timeout value to a positive number. For example:

db1 timeout 2000

The argument to the timeout method is the maximum number of milliseconds to wait for the lock to clear. So in the example above, the maximum delay would be 2 seconds.

The "busy" method

The "busy" method, like "timeout", only comes into play when the database is locked. But the "busy" method gives the programmer much more control over what action to take. The "busy" method specifies a callback Tcl procedure that is invoked whenever SQLite tries to open a locked database. This callback can do whatever is desired. Presumably, the callback will do some other useful work for a short while then return so that the lock can be tried again. The callback procedure should return "0" if it wants SQLite to try again to open the database and should return "1" if it wants SQLite to abandon the current operation.

The "last_insert_rowid" method

The "last_insert_rowid" method returns an integer which is the ROWID of the most recently inserted database row.

The "onecolumn" method

The "onecolumn" method works like "eval" in that it evaluates the SQL query statement given as its argument. The difference is that "onecolumn" returns a single element which is the first column of the first row of the query result.

This is a convenience method. It saves the user from having to do a "[lindex ... 0]" on the results of an "eval" in order to extract a single column result.

The "changes" method

The "changes" method returns an integer which is the number of rows in the database that were inserted, deleted, and/or modified by the most recent "eval" method.

} puts {


Back to the SQLite Home Page

} sqlite-2.8.17/www/changes.tcl0000644000175000001440000012622110232547612016014 0ustar drhusers00000000000000# # Run this script to generated a changes.html output file # puts { SQLite Change Log

Recent Changes To SQLite

This file provides a high-level summary of changes to SQLite. For more detail, refer the the checkin logs generated by CVS at http:/www.sqlite.org/cvstrac/timeline.

} proc chng {date desc} { puts "
$date
" puts "

    $desc

" } chng {2004 March 8 (2.8.13)} {
  • Refactor parts of the code in order to make the code footprint smaller. The code is now also a little bit faster.
  • sqlite_exec() is now implemented as a wrapper around sqlite_compile() and sqlite_step().
  • The built-in min() and max() functions now honor the difference between NUMERIC and TEXT datatypes. Formerly, min() and max() always assumed their arguments were of type NUMERIC.
  • New HH:MM:SS modifier to the built-in date/time functions.
  • Experimental sqlite_last_statement_changes() API added. Fixed the the last_insert_rowid() function so that it works correctly with triggers.
  • Add functions prototypes for the database encryption API.
  • Fix several nuisance bugs.
  • } chng {2004 February 8 (2.8.12)} {
  • Fix a bug that will might corrupt the rollback journal if a power failure or external program halt occurs in the middle of a COMMIT. The corrupt journal can lead to database corruption when it is rolled back.
  • Reduce the size and increase the speed of various modules, especially the virtual machine.
  • Allow "<expr> IN <table>" as a shorthand for "<expr> IN (SELECT * FROM <table>".
  • Optimizations to the sqlite_mprintf() routine.
  • Make sure the MIN() and MAX() optimizations work within subqueries.
  • } chng {2004 January 14 (2.8.11)} {
  • Fix a bug in how the IN operator handles NULLs in subqueries. The bug was introduced by the previous release.
  • } chng {2004 January 13 (2.8.10)} {
  • Fix a potential database corruption problem on Unix caused by the fact that all posix advisory locks are cleared whenever you close() a file. The work around it to embargo all close() calls while locks are outstanding.
  • Performance enhancements on some corner cases of COUNT(*).
  • Make sure the in-memory backend response sanely if malloc() fails.
  • Allow sqlite_exec() to be called from within user-defined SQL functions.
  • Improved accuracy of floating-point conversions using "long double".
  • Bug fixes in the experimental date/time functions.
  • } chng {2004 January 5 (2.8.9)} {
  • Fix a 32-bit integer overflow problem that could result in corrupt indices in a database if large negative numbers (less than -2147483648) were inserted into a indexed numeric column.
  • Fix a locking problem on multi-threaded Linux implementations.
  • Always use "." instead of "," as the decimal point even if the locale requests ",".
  • Added UTC to localtime conversions to the experimental date/time functions.
  • Bug fixes to date/time functions.
  • } chng {2003 December 17 (2.8.8)} {
  • Fix a critical bug introduced into 2.8.0 which could cause database corruption.
  • Fix a problem with 3-way joins that do not use indices
  • The VACUUM command now works with the non-callback API
  • Improvements to the "PRAGMA integrity_check" command
  • } chng {2003 December 4 (2.8.7)} {
  • Added experimental sqlite_bind() and sqlite_reset() APIs.
  • If the name of the database is an empty string, open a new database in a temporary file that is automatically deleted when the database is closed.
  • Performance enhancements in the lemon-generated parser
  • Experimental date/time functions revised.
  • Disallow temporary indices on permanent tables.
  • Documentation updates and typo fixes
  • Added experimental sqlite_progress_handler() callback API
  • Removed support for the Oracle8 outer join syntax.
  • Allow GLOB and LIKE operators to work as functions.
  • Other minor documentation and makefile changes and bug fixes.
  • } chng {2003 August 21 (2.8.6)} {
  • Moved the CVS repository to www.sqlite.org
  • Update the NULL-handling documentation.
  • Experimental date/time functions added.
  • Bug fix: correctly evaluate a view of a view without segfaulting.
  • Bug fix: prevent database corruption if you dropped a trigger that had the same name as a table.
  • Bug fix: allow a VACUUM (without segfaulting) on an empty database after setting the EMPTY_RESULT_CALLBACKS pragma.
  • Bug fix: if an integer value will not fit in a 32-bit int, store it in a double instead.
  • Bug fix: Make sure the journal file directory entry is committed to disk before writing the database file.
  • } chng {2003 July 22 (2.8.5)} {
  • Make LIMIT work on a compound SELECT statement.
  • LIMIT 0 now shows no rows. Use LIMIT -1 to see all rows.
  • Correctly handle comparisons between an INTEGER PRIMARY KEY and a floating point number.
  • Fix several important bugs in the new ATTACH and DETACH commands.
  • Updated the NULL-handling document.
  • Allow NULL arguments in sqlite_compile() and sqlite_step().
  • Many minor bug fixes
  • } chng {2003 June 29 (2.8.4)} {
  • Enhanced the "PRAGMA integrity_check" command to verify indices.
  • Added authorization hooks for the new ATTACH and DETACH commands.
  • Many documentation updates
  • Many minor bug fixes
  • } chng {2003 June 4 (2.8.3)} {
  • Fix a problem that will corrupt the indices on a table if you do an INSERT OR REPLACE or an UPDATE OR REPLACE on a table that contains an INTEGER PRIMARY KEY plus one or more indices.
  • Fix a bug in windows locking code so that locks work correctly when simultaneously accessed by Win95 and WinNT systems.
  • Add the ability for INSERT and UPDATE statements to refer to the "rowid" (or "_rowid_" or "oid") columns.
  • Other important bug fixes
  • } chng {2003 May 17 (2.8.2)} {
  • Fix a problem that will corrupt the database file if you drop a table from the main database that has a TEMP index.
  • } chng {2003 May 16 (2.8.1)} {
  • Reactivated the VACUUM command that reclaims unused disk space in a database file.
  • Added the ATTACH and DETACH commands to allow interacting with multiple database files at the same time.
  • Added support for TEMP triggers and indices.
  • Added support for in-memory databases.
  • Removed the experimental sqlite_open_aux_file(). Its function is subsumed in the new ATTACH command.
  • The precedence order for ON CONFLICT clauses was changed so that ON CONFLICT clauses on BEGIN statements have a higher precedence than ON CONFLICT clauses on constraints.
  • Many, many bug fixes and compatibility enhancements.
  • } chng {2003 Feb 16 (2.8.0)} {
  • Modified the journal file format to make it more resistant to corruption that can occur after an OS crash or power failure.
  • Added a new C/C++ API that does not use callback for returning data.
  • } chng {2003 Jan 25 (2.7.6)} {
  • Performance improvements. The library is now much faster.
  • Added the sqlite_set_authorizer() API. Formal documentation has not been written - see the source code comments for instructions on how to use this function.
  • Fix a bug in the GLOB operator that was preventing it from working with upper-case letters.
  • Various minor bug fixes.
  • } chng {2002 Dec 27 (2.7.5)} {
  • Fix an uninitialized variable in pager.c which could (with a probability of about 1 in 4 billion) result in a corrupted database.
  • } chng {2002 Dec 17 (2.7.4)} {
  • Database files can now grow to be up to 2^41 bytes. The old limit was 2^31 bytes.
  • The optimizer will now scan tables in the reverse if doing so will satisfy an ORDER BY ... DESC clause.
  • The full pathname of the database file is now remembered even if a relative path is passed into sqlite_open(). This allows the library to continue operating correctly after a chdir().
  • Speed improvements in the VDBE.
  • Lots of little bug fixes.
  • } chng {2002 Oct 30 (2.7.3)} {
  • Various compiler compatibility fixes.
  • Fix a bug in the "expr IN ()" operator.
  • Accept column names in parentheses.
  • Fix a problem with string memory management in the VDBE
  • Fix a bug in the "table_info" pragma"
  • Export the sqlite_function_type() API function in the Windows DLL
  • Fix locking behavior under windows
  • Fix a bug in LEFT OUTER JOIN
  • } chng {2002 Sep 25 (2.7.2)} {
  • Prevent journal file overflows on huge transactions.
  • Fix a memory leak that occurred when sqlite_open() failed.
  • Honor the ORDER BY and LIMIT clause of a SELECT even if the result set is used for an INSERT.
  • Do not put write locks on the file used to hold TEMP tables.
  • Added documention on SELECT DISTINCT and on how SQLite handles NULLs.
  • Fix a problem that was causing poor performance when many thousands of SQL statements were executed by a single sqlite_exec() call.
  • } chng {2002 Aug 31 (2.7.1)} {
  • Fix a bug in the ORDER BY logic that was introduced in version 2.7.0
  • C-style comments are now accepted by the tokenizer.
  • INSERT runs a little faster when the source is a SELECT statement.
  • } chng {2002 Aug 25 (2.7.0)} {
  • Make a distinction between numeric and text values when sorting. Text values sort according to memcmp(). Numeric values sort in numeric order.
  • Allow multiple simulataneous readers under windows by simulating the reader/writers locks that are missing from Win95/98/ME.
  • An error is now returned when trying to start a transaction if another transaction is already active.
  • } chng {2002 Aug 12 (2.6.3)} {
  • Add the ability to read both little-endian and big-endian databases. So database created under SunOS or MacOSX can be read and written under Linux or Windows and vice versa.
  • Convert to the new website: http://www.sqlite.org/
  • Allow transactions to span Linux Threads
  • Bug fix in the processing of the ORDER BY clause for GROUP BY queries
  • } chng {2002 Jly 30 (2.6.2)} {
  • Text files read by the COPY command can now have line terminators of LF, CRLF, or CR.
  • SQLITE_BUSY is handled correctly if encountered during database initialization.
  • Fix to UPDATE triggers on TEMP tables.
  • Documentation updates.
  • } chng {2002 Jly 19 (2.6.1)} {
  • Include a static string in the library that responds to the RCS "ident" command and which contains the library version number.
  • Fix an assertion failure that occurred when deleting all rows of a table with the "count_changes" pragma turned on.
  • Better error reporting when problems occur during the automatic 2.5.6 to 2.6.0 database format upgrade.
  • } chng {2002 Jly 17 (2.6.0)} {
  • Change the format of indices to correct a design flaw the originated with version 2.1.0. *** This is an incompatible file format change *** When version 2.6.0 or later of the library attempts to open a database file created by version 2.5.6 or earlier, it will automatically and irreversibly convert the file format. Make backup copies of older database files before opening them with version 2.6.0 of the library.
  • } chng {2002 Jly 7 (2.5.6)} {
  • Fix more problems with rollback. Enhance the test suite to exercise the rollback logic extensively in order to prevent any future problems.
  • } chng {2002 Jly 6 (2.5.5)} {
  • Fix a bug which could cause database corruption during a rollback. This bugs was introduced in version 2.4.0 by the freelist optimization of checking [410].
  • Fix a bug in aggregate functions for VIEWs.
  • Other minor changes and enhancements.
  • } chng {2002 Jly 1 (2.5.4)} {
  • Make the "AS" keyword optional again.
  • The datatype of columns now appear in the 4th argument to the callback.
  • Added the sqlite_open_aux_file() API, though it is still mostly undocumented and untested.
  • Added additional test cases and fixed a few bugs that those test cases found.
  • } chng {2002 Jun 24 (2.5.3)} {
  • Bug fix: Database corruption can occur due to the optimization that was introduced in version 2.4.0 (check-in [410]). The problem should now be fixed. The use of versions 2.4.0 through 2.5.2 is not recommended.
  • } chng {2002 Jun 24 (2.5.2)} {
  • Added the new SQLITE_TEMP_MASTER table which records the schema for temporary tables in the same way that SQLITE_MASTER does for persistent tables.
  • Added an optimization to UNION ALL
  • Fixed a bug in the processing of LEFT OUTER JOIN
  • The LIMIT clause now works on subselects
  • ORDER BY works on subselects
  • There is a new TypeOf() function used to determine if an expression is numeric or text.
  • Autoincrement now works for INSERT from a SELECT.
  • } chng {2002 Jun 19 (2.5.1)} {
  • The query optimizer now attempts to implement the ORDER BY clause using an index. Sorting is still used if not suitable index is available.
  • } chng {2002 Jun 17 (2.5.0)} {
  • Added support for row triggers.
  • Added SQL-92 compliant handling of NULLs.
  • Add support for the full SQL-92 join syntax and LEFT OUTER JOINs.
  • Double-quoted strings interpreted as column names not text literals.
  • Parse (but do not implement) foreign keys.
  • Performance improvemenets in the parser, pager, and WHERE clause code generator.
  • Make the LIMIT clause work on subqueries. (ORDER BY still does not work, though.)
  • Added the "%Q" expansion to sqlite_*_printf().
  • Bug fixes too numerious to mention (see the change log).
  • } chng {2002 May 09 (2.4.12)} {
  • Added logic to detect when the library API routines are called out of sequence.
  • } chng {2002 May 08 (2.4.11)} {
  • Bug fix: Column names in the result set were not being generated correctly for some (rather complex) VIEWs. This could cause a segfault under certain circumstances.
  • } chng {2002 May 02 (2.4.10)} {
  • Bug fix: Generate correct column headers when a compound SELECT is used as a subquery.
  • Added the sqlite_encode_binary() and sqlite_decode_binary() functions to the source tree. But they are not yet linked into the library.
  • Documentation updates.
  • Export the sqlite_changes() function from windows DLLs.
  • Bug fix: Do not attempt the subquery flattening optimization on queries that lack a FROM clause. To do so causes a segfault.
  • } chng {2002 Apr 21 (2.4.9)} {
  • Fix a bug that was causing the precompiled binary of SQLITE.EXE to report "out of memory" under Windows 98.
  • } chng {2002 Apr 20 (2.4.8)} {
  • Make sure VIEWs are created after their corresponding TABLEs in the output of the .dump command in the shell.
  • Speed improvements: Do not do synchronous updates on TEMP tables.
  • Many improvements and enhancements to the shell.
  • Make the GLOB and LIKE operators functions that can be overridden by a programmer. This allows, for example, the LIKE operator to be changed to be case sensitive.
  • } chng {2002 Apr 06 (2.4.7)} {
  • Add the ability to put TABLE.* in the column list of a SELECT statement.
  • Permit SELECT statements without a FROM clause.
  • Added the last_insert_rowid() SQL function.
  • Do not count rows where the IGNORE conflict resultion occurs in the row count.
  • Make sure functions expressions in the VALUES clause of an INSERT are correct.
  • Added the sqlite_changes() API function to return the number of row that changed in the most recent operation.
  • } chng {2002 Apr 02 (2.4.6)} {
  • Bug fix: Correctly handle terms in the WHERE clause of a join that do not contain a comparison operator.
  • } chng {2002 Apr 01 (2.4.5)} {
  • Bug fix: Correctly handle functions that appear in the WHERE clause of a join.
  • When the PRAGMA vdbe_trace=ON is set, correctly print the P3 operand value when it is a pointer to a structure rather than a pointer to a string.
  • When inserting an explicit NULL into an INTEGER PRIMARY KEY, convert the NULL value into a unique key automatically.
  • } chng {2002 Mar 24 (2.4.4)} {
  • Allow "VIEW" to be a column name
  • Added support for CASE expressions (patch from Dan Kennedy)
  • Added RPMS to the delivery (patches from Doug Henry)
  • Fix typos in the documentation
  • Cut over configuration management to a new CVS repository with its own CVSTrac bug tracking system.
  • } chng {2002 Mar 22 (2.4.3)} {
  • Fix a bug in SELECT that occurs when a compound SELECT is used as a subquery in the FROM of a SELECT.
  • The sqlite_get_table() function now returns an error if you give it two or more SELECTs that return different numbers of columns.
  • } chng {2002 Mar 14 (2.4.2)} {
  • Bug fix: Fix an assertion failure that occurred when ROWID was a column in a SELECT statement on a view.
  • Bug fix: Fix an uninitialized variable in the VDBE that would could an assert failure.
  • Make the os.h header file more robust in detecting when the compile is for windows and when it is for unix.
  • } chng {2002 Mar 13 (2.4.1)} {
  • Using an unnamed subquery in a FROM clause would cause a segfault.
  • The parser now insists on seeing a semicolon or the end of input before executing a statement. This avoids an accidental disaster if the WHERE keyword is misspelled in an UPDATE or DELETE statement.
  • } chng {2002 Mar 10 (2.4.0)} {
  • Change the name of the sanity_check PRAGMA to integrity_check and make it available in all compiles.
  • SELECT min() or max() of an indexed column with no WHERE or GROUP BY clause is handled as a special case which avoids a complete table scan.
  • Automatically generated ROWIDs are now sequential.
  • Do not allow dot-commands of the command-line shell to occur in the middle of a real SQL command.
  • Modifications to the "lemon" parser generator so that the parser tables are 4 times smaller.
  • Added support for user-defined functions implemented in C.
  • Added support for new functions: coalesce(), lower(), upper(), and random()
  • Added support for VIEWs.
  • Added the subquery flattening optimizer.
  • Modified the B-Tree and Pager modules so that disk pages that do not contain real data (free pages) are not journalled and are not written from memory back to the disk when they change. This does not impact database integrity, since the pages contain no real data, but it does make large INSERT operations about 2.5 times faster and large DELETEs about 5 times faster.
  • Made the CACHE_SIZE pragma persistent
  • Added the SYNCHRONOUS pragma
  • Fixed a bug that was causing updates to fail inside of transactions when the database contained a temporary table.
  • } chng {2002 Feb 18 (2.3.3)} {
  • Allow identifiers to be quoted in square brackets, for compatibility with MS-Access.
  • Added support for sub-queries in the FROM clause of a SELECT.
  • More efficient implementation of sqliteFileExists() under Windows. (by Joel Luscy)
  • The VALUES clause of an INSERT can now contain expressions, including scalar SELECT clauses.
  • Added support for CREATE TABLE AS SELECT
  • Bug fix: Creating and dropping a table all within a single transaction was not working.
  • } chng {2002 Feb 14 (2.3.2)} {
  • Bug fix: There was an incorrect assert() in pager.c. The real code was all correct (as far as is known) so everything should work OK if you compile with -DNDEBUG=1. When asserts are not disabled, there could be a fault.
  • } chng {2002 Feb 13 (2.3.1)} {
  • Bug fix: An assertion was failing if "PRAGMA full_column_names=ON;" was set and you did a query that used a rowid, like this: "SELECT rowid, * FROM ...".
  • } chng {2002 Jan 30 (2.3.0)} {
  • Fix a serious bug in the INSERT command which was causing data to go into the wrong columns if the data source was a SELECT and the INSERT clauses specified its columns in some order other than the default.
  • Added the ability to resolve constraint conflicts is ways other than an abort and rollback. See the documentation on the "ON CONFLICT" clause for details.
  • Temporary files are now automatically deleted by the operating system when closed. There are no more dangling temporary files on a program crash. (If the OS crashes, fsck will delete the file after reboot under Unix. I do not know what happens under Windows.)
  • NOT NULL constraints are honored.
  • The COPY command puts NULLs in columns whose data is '\N'.
  • In the COPY command, backslash can now be used to escape a newline.
  • Added the SANITY_CHECK pragma.
  • } chng {2002 Jan 28 (2.2.5)} {
  • Important bug fix: the IN operator was not working if either the left-hand or right-hand side was derived from an INTEGER PRIMARY KEY.
  • Do not escape the backslash '\' character in the output of the sqlite command-line access program.
  • } chng {2002 Jan 22 (2.2.4)} {
  • The label to the right of an AS in the column list of a SELECT can now be used as part of an expression in the WHERE, ORDER BY, GROUP BY, and/or HAVING clauses.
  • Fix a bug in the -separator command-line option to the sqlite command.
  • Fix a problem with the sort order when comparing upper-case strings against characters greater than 'Z' but less than 'a'.
  • Report an error if an ORDER BY or GROUP BY expression is constant.
  • } chng {2002 Jan 16 (2.2.3)} {
  • Fix warning messages in VC++ 7.0. (Patches from nicolas352001)
  • Make the library thread-safe. (The code is there and appears to work but has not been stressed.)
  • Added the new sqlite_last_insert_rowid() API function.
  • } chng {2002 Jan 13 (2.2.2)} {
  • Bug fix: An assertion was failing when a temporary table with an index had the same name as a permanent table created by a separate process.
  • Bug fix: Updates to tables containing an INTEGER PRIMARY KEY and an index could fail.
  • } chng {2002 Jan 9 (2.2.1)} {
  • Bug fix: An attempt to delete a single row of a table with a WHERE clause of "ROWID=x" when no such rowid exists was causing an error.
  • Bug fix: Passing in a NULL as the 3rd parameter to sqlite_open() would sometimes cause a coredump.
  • Bug fix: DROP TABLE followed by a CREATE TABLE with the same name all within a single transaction was causing a coredump.
  • Makefile updates from A. Rottmann
  • } chng {2001 Dec 22 (2.2.0)} {
  • Columns of type INTEGER PRIMARY KEY are actually used as the primary key in underlying B-Tree representation of the table.
  • Several obscure, unrelated bugs were found and fixed while implemented the integer primary key change of the previous bullet.
  • Added the ability to specify "*" as part of a larger column list in the result section of a SELECT statement. For example: "SELECT rowid, * FROM table1;".
  • Updates to comments and documentation.
  • } chng {2001 Dec 14 (2.1.7)} {
  • Fix a bug in CREATE TEMPORARY TABLE which was causing the table to be initially allocated in the main database file instead of in the separate temporary file. This bug could cause the library to suffer an assertion failure and it could cause "page leaks" in the main database file.
  • Fix a bug in the b-tree subsystem that could sometimes cause the first row of a table to be repeated during a database scan.
  • } chng {2001 Dec 14 (2.1.6)} {
  • Fix the locking mechanism yet again to prevent sqlite_exec() from returning SQLITE_PROTOCOL unnecessarily. This time the bug was a race condition in the locking code. This change effects both POSIX and Windows users.
  • } chng {2001 Dec 6 (2.1.5)} {
  • Fix for another problem (unrelated to the one fixed in 2.1.4) that sometimes causes sqlite_exec() to return SQLITE_PROTOCOL unnecessarily. This time the bug was in the POSIX locking code and should not effect windows users.
  • } chng {2001 Dec 4 (2.1.4)} {
  • Sometimes sqlite_exec() would return SQLITE_PROTOCOL when it should have returned SQLITE_BUSY.
  • The fix to the previous bug uncovered a deadlock which was also fixed.
  • Add the ability to put a single .command in the second argument of the sqlite shell
  • Updates to the FAQ
  • } chng {2001 Nov 23 (2.1.3)} {
  • Fix the behavior of comparison operators (ex: "<", "==", etc.) so that they are consistent with the order of entries in an index.
  • Correct handling of integers in SQL expressions that are larger than what can be represented by the machine integer.
  • } chng {2001 Nov 22 (2.1.2)} {
  • Changes to support 64-bit architectures.
  • Fix a bug in the locking protocol.
  • Fix a bug that could (rarely) cause the database to become unreadable after a DROP TABLE due to corruption to the SQLITE_MASTER table.
  • Change the code so that version 2.1.1 databases that were rendered unreadable by the above bug can be read by this version of the library even though the SQLITE_MASTER table is (slightly) corrupted.
  • } chng {2001 Nov 13 (2.1.1)} {
  • Bug fix: Sometimes arbirary strings were passed to the callback function when the actual value of a column was NULL.
  • } chng {2001 Nov 12 (2.1.0)} {
  • Change the format of data records so that records up to 16MB in size can be stored.
  • Change the format of indices to allow for better query optimization.
  • Implement the "LIMIT ... OFFSET ..." clause on SELECT statements.
  • } chng {2001 Nov 3 (2.0.8)} {
  • Made selected parameters in API functions const. This should be fully backwards compatible.
  • Documentation updates
  • Simplify the design of the VDBE by restricting the number of sorters and lists to 1. In practice, no more than one sorter and one list was ever used anyhow.
  • } chng {2001 Oct 21 (2.0.7)} {
  • Any UTF-8 character or ISO8859 character can be used as part of an identifier.
  • Patches from Christian Werner to improve ODBC compatibility and to fix a bug in the round() function.
  • Plug some memory leaks that use to occur if malloc() failed. We have been and continue to be memory leak free as long as malloc() works.
  • Changes to some test scripts so that they work on Windows in addition to Unix.
  • } chng {2001 Oct 19 (2.0.6)} {
  • Added the EMPTY_RESULT_CALLBACKS pragma
  • Support for UTF-8 and ISO8859 characters in column and table names.
  • Bug fix: Compute correct table names with the FULL_COLUMN_NAMES pragma is turned on.
  • } chng {2001 Oct 14 (2.0.5)} {
  • Added the COUNT_CHANGES pragma.
  • Changes to the FULL_COLUMN_NAMES pragma to help out the ODBC driver.
  • Bug fix: "SELECT count(*)" was returning NULL for empty tables. Now it returns 0.
  • } chng {2001 Oct 13 (2.0.4)} {
  • Bug fix: an abscure and relatively harmless bug was causing one of the tests to fail when gcc optimizations are turned on. This release fixes the problem.
  • } chng {2001 Oct 13 (2.0.3)} {
  • Bug fix: the sqlite_busy_timeout() function was delaying 1000 times too long before failing.
  • Bug fix: an assertion was failing if the disk holding the database file became full or stopped accepting writes for some other reason. New tests were added to detect similar problems in the future.
  • Added new operators: & (bitwise-and) | (bitwise-or), ~ (ones-complement), << (shift left), >> (shift right).
  • Added new functions: round() and abs().
  • } chng {2001 Oct 9 (2.0.2)} {
  • Fix two bugs in the locking protocol. (One was masking the other.)
  • Removed some unused "#include " that were causing problems for VC++.
  • Fixed sqlite.h so that it is usable from C++
  • Added the FULL_COLUMN_NAMES pragma. When set to "ON", the names of columns are reported back as TABLE.COLUMN instead of just COLUMN.
  • Added the TABLE_INFO() and INDEX_INFO() pragmas to help support the ODBC interface.
  • Added support for TEMPORARY tables and indices.
  • } chng {2001 Oct 2 (2.0.1)} {
  • Remove some C++ style comments from btree.c so that it will compile using compilers other than gcc.
  • The ".dump" output from the shell does not work if there are embedded newlines anywhere in the data. This is an old bug that was carried forward from version 1.0. To fix it, the ".dump" output no longer uses the COPY command. It instead generates INSERT statements.
  • Extend the expression syntax to support "expr NOT NULL" (with a space between the "NOT" and the "NULL") in addition to "expr NOTNULL" (with no space).
  • } chng {2001 Sep 28 (2.0.0)} {
  • Automatically build binaries for Linux and Windows and put them on the website.
  • } chng {2001 Sep 28 (2.0-alpha-4)} {
  • Incorporate makefile patches form A. Rottmann to use LIBTOOL
  • } chng {2001 Sep 27 (2.0-alpha-3)} {
  • SQLite now honors the UNIQUE keyword in CREATE UNIQUE INDEX. Primary keys are required to be unique.
  • File format changed back to what it was for alpha-1
  • Fixes to the rollback and locking behavior
  • } chng {2001 Sep 20 (2.0-alpha-2)} {
  • Initial release of version 2.0. The idea of renaming the library to "SQLus" was abandoned in favor of keeping the "SQLite" name and bumping the major version number.
  • The pager and btree subsystems added back. They are now the only available backend.
  • The Dbbe abstraction and the GDBM and memory drivers were removed.
  • Copyright on all code was disclaimed. The library is now in the public domain.
  • } chng {2001 Jul 23 (1.0.32)} {
  • Pager and btree subsystems removed. These will be used in a follow-on SQL server library named "SQLus".
  • Add the ability to use quoted strings as table and column names in expressions.
  • } chng {2001 Apr 14 (1.0.31)} {
  • Pager subsystem added but not yet used.
  • More robust handling of out-of-memory errors.
  • New tests added to the test suite.
  • } chng {2001 Apr 6 (1.0.30)} {
  • Remove the sqlite_encoding TCL variable that was introduced in the previous version.
  • Add options -encoding and -tcl-uses-utf to the sqlite TCL command.
  • Add tests to make sure that tclsqlite was compiled using Tcl header files and libraries that match.
  • } chng {2001 Apr 5 (1.0.29)} {
  • The library now assumes data is stored as UTF-8 if the --enable-utf8 option is given to configure. The default behavior is to assume iso8859-x, as it has always done. This only makes a difference for LIKE and GLOB operators and the LENGTH and SUBSTR functions.
  • If the library is not configured for UTF-8 and the Tcl library is one of the newer ones that uses UTF-8 internally, then a conversion from UTF-8 to iso8859 and back again is done inside the TCL interface.
  • } chng {2001 Apr 4 (1.0.28)} {
  • Added limited support for transactions. At this point, transactions will do table locking on the GDBM backend. There is no support (yet) for rollback or atomic commit.
  • Added special column names ROWID, OID, and _ROWID_ that refer to the unique random integer key associated with every row of every table.
  • Additional tests added to the regression suite to cover the new ROWID feature and the TCL interface bugs mentioned below.
  • Changes to the "lemon" parser generator to help it work better when compiled using MSVC.
  • Bug fixes in the TCL interface identified by Oleg Oleinick.
  • } chng {2001 Mar 20 (1.0.27)} {
  • When doing DELETE and UPDATE, the library used to write the record numbers of records to be deleted or updated into a temporary file. This is changed so that the record numbers are held in memory.
  • The DELETE command without a WHILE clause just removes the database files from the disk, rather than going through and deleting record by record.
  • } chng {2001 Mar 20 (1.0.26)} {
  • A serious bug fixed on Windows. Windows users should upgrade. No impact to Unix.
  • } chng {2001 Mar 15 (1.0.25)} {
  • Modify the test scripts to identify tests that depend on system load and processor speed and to warn the user that a failure of one of those (rare) tests does not necessarily mean the library is malfunctioning. No changes to code.
  • } chng {2001 Mar 14 (1.0.24)} {
  • Fix a bug which was causing the UPDATE command to fail on systems where "malloc(0)" returns NULL. The problem does not appear Windows, Linux, or HPUX but does cause the library to fail on QNX.
  • } chng {2001 Feb 19 (1.0.23)} {
  • An unrelated (and minor) bug from Mark Muranwski fixed. The algorithm for figuring out where to put temporary files for a "memory:" database was not working quite right.
  • } chng {2001 Feb 19 (1.0.22)} {
  • The previous fix was not quite right. This one seems to work better.
  • } chng {2001 Feb 19 (1.0.21)} {
  • The UPDATE statement was not working when the WHERE clause contained some terms that could be satisfied using indices and other terms that could not. Fixed.
  • } chng {2001 Feb 11 (1.0.20)} {
  • Merge development changes into the main trunk. Future work toward using a BTree file structure will use a separate CVS source tree. This CVS tree will continue to support the GDBM version of SQLite only.
  • } chng {2001 Feb 6 (1.0.19)} {
  • Fix a strange (but valid) C declaration that was causing problems for QNX. No logical changes.
  • } chng {2001 Jan 4 (1.0.18)} {
  • Print the offending SQL statement when an error occurs.
  • Do not require commas between constraints in CREATE TABLE statements.
  • Added the "-echo" option to the shell.
  • Changes to comments.
  • } chng {2000 Dec 10 (1.0.17)} {
  • Rewrote sqlite_complete() to make it faster.
  • Minor tweaks to other code to make it run a little faster.
  • Added new tests for sqlite_complete() and for memory leaks.
  • } chng {2000 Dec 4 (1.0.16)} {
  • Documentation updates. Mostly fixing of typos and spelling errors.
  • } chng {2000 Oct 23 (1.0.15)} {
  • Documentation updates
  • Some sanity checking code was removed from the inner loop of vdbe.c to help the library to run a little faster. The code is only removed if you compile with -DNDEBUG.
  • } chng {2000 Oct 19 (1.0.14)} {
  • Added a "memory:" backend driver that stores its database in an in-memory hash table.
  • } chng {2000 Oct 18 (1.0.13)} {
  • Break out the GDBM driver into a separate file in anticipation to added new drivers.
  • Allow the name of a database to be prefixed by the driver type. For now, the only driver type is "gdbm:".
  • } chng {2000 Oct 16 (1.0.12)} {
  • Fixed an off-by-one error that was causing a coredump in the '%q' format directive of the new sqlite_..._printf() routines.
  • Added the sqlite_interrupt() interface.
  • In the shell, sqlite_interrupt() is invoked when the user presses Control-C
  • Fixed some instances where sqlite_exec() was returning the wrong error code.
  • } chng {2000 Oct 11 (1.0.10)} {
  • Added notes on how to compile for Windows95/98.
  • Removed a few variables that were not being used. Etc.
  • } chng {2000 Oct 8 (1.0.9)} {
  • Added the sqlite_..._printf() interface routines.
  • Modified the sqlite shell program to use the new interface routines.
  • Modified the sqlite shell program to print the schema for the built-in SQLITE_MASTER table, if explicitly requested.
  • } chng {2000 Sep 30 (1.0.8)} {
  • Begin writing documentation on the TCL interface.
  • } chng {2000 Sep 29 (Not Released)} {
  • Added the sqlite_get_table() API
  • Updated the documentation for due to the above change.
  • Modified the sqlite shell to make use of the new sqlite_get_table() API in order to print a list of tables in multiple columns, similar to the way "ls" prints filenames.
  • Modified the sqlite shell to print a semicolon at the end of each CREATE statement in the output of the ".schema" command.
  • } chng {2000 Sep 21 (Not Released)} {
  • Change the tclsqlite "eval" method to return a list of results if no callback script is specified.
  • Change tclsqlite.c to use the Tcl_Obj interface
  • Add tclsqlite.c to the libsqlite.a library
  • } chng {2000 Sep 13 (Version 1.0.5)} {
  • Changed the print format for floating point values from "%g" to "%.15g".
  • Changed the comparison function so that numbers in exponential notation (ex: 1.234e+05) sort in numerical order.
  • } chng {2000 Aug 28 (Version 1.0.4)} {
  • Added functions length() and substr().
  • Fix a bug in the sqlite shell program that was causing a coredump when the output mode was "column" and the first row of data contained a NULL.
  • } chng {2000 Aug 22 (Version 1.0.3)} {
  • In the sqlite shell, print the "Database opened READ ONLY" message to stderr instead of stdout.
  • In the sqlite shell, now print the version number on initial startup.
  • Add the sqlite_version[] string constant to the library
  • Makefile updates
  • Bug fix: incorrect VDBE code was being generated for the following circumstance: a query on an indexed table containing a WHERE clause with an IN operator that had a subquery on its right-hand side.
  • } chng {2000 Aug 18 (Version 1.0.1)} {
  • Fix a bug in the configure script.
  • Minor revisions to the website.
  • } chng {2000 Aug 17 (Version 1.0)} {
  • Change the sqlite program so that it can read databases for which it lacks write permission. (It used to refuse all access if it could not write.)
  • } chng {2000 Aug 9} {
  • Treat carriage returns as white space.
  • } chng {2000 Aug 8} {
  • Added pattern matching to the ".table" command in the "sqlite" command shell.
  • } chng {2000 Aug 4} {
  • Documentation updates
  • Added "busy" and "timeout" methods to the Tcl interface
  • } chng {2000 Aug 3} {
  • File format version number was being stored in sqlite_master.tcl multiple times. This was harmless, but unnecessary. It is now fixed.
  • } chng {2000 Aug 2} {
  • The file format for indices was changed slightly in order to work around an inefficiency that can sometimes come up with GDBM when there are large indices having many entries with the same key. ** Incompatible Change **
  • } chng {2000 Aug 1} {
  • The parser's stack was overflowing on a very long UPDATE statement. This is now fixed.
  • } chng {2000 July 31} {
  • Finish the VDBE tutorial.
  • Added documentation on compiling to WindowsNT.
  • Fix a configuration program for WindowsNT.
  • Fix a configuration problem for HPUX.
  • } chng {2000 July 29} {
  • Better labels on column names of the result.
  • } chng {2000 July 28} {
  • Added the sqlite_busy_handler() and sqlite_busy_timeout() interface.
  • } chng {2000 June 23} {
  • Begin writing the VDBE tutorial.
  • } chng {2000 June 21} {
  • Clean up comments and variable names. Changes to documentation. No functional changes to the code.
  • } chng {2000 June 19} {
  • Column names in UPDATE statements were case sensitive. This mistake has now been fixed.
  • } chng {2000 June 16} {
  • Added the concatenate string operator (||)
  • } chng {2000 June 12} {
  • Added the fcnt() function to the SQL interpreter. The fcnt() function returns the number of database "Fetch" operations that have occurred. This function is designed for use in test scripts to verify that queries are efficient and appropriately optimized. Fcnt() has no other useful purpose, as far as I know.
  • Added a bunch more tests that take advantage of the new fcnt() function. The new tests did not uncover any new problems.
  • } chng {2000 June 8} {
  • Added lots of new test cases
  • Fix a few bugs discovered while adding test cases
  • Begin adding lots of new documentation
  • } chng {2000 June 6} {
  • Added compound select operators: UNION, UNION ALL, INTERSECT, and EXCEPT
  • Added support for using (SELECT ...) within expressions
  • Added support for IN and BETWEEN operators
  • Added support for GROUP BY and HAVING
  • NULL values are now reported to the callback as a NULL pointer rather than an empty string.
  • } chng {2000 June 3} {
  • Added support for default values on columns of a table.
  • Improved test coverage. Fixed a few obscure bugs found by the improved tests.
  • } chng {2000 June 2} {
  • All database files to be modified by an UPDATE, INSERT or DELETE are now locked before any changes are made to any files. This makes it safe (I think) to access the same database simultaneously from multiple processes.
  • The code appears stable so we are now calling it "beta".
  • } chng {2000 June 1} {
  • Better support for file locking so that two or more processes (or threads) can access the same database simultaneously. More work needed in this area, though.
  • } chng {2000 May 31} {
  • Added support for aggregate functions (Ex: COUNT(*), MIN(...)) to the SELECT statement.
  • Added support for SELECT DISTINCT ...
  • } chng {2000 May 30} {
  • Added the LIKE operator.
  • Added a GLOB operator: similar to LIKE but it uses Unix shell globbing wildcards instead of the '%' and '_' wildcards of SQL.
  • Added the COPY command patterned after PostgreSQL so that SQLite can now read the output of the pg_dump database dump utility of PostgreSQL.
  • Added a VACUUM command that that calls the gdbm_reorganize() function on the underlying database files.
  • And many, many bug fixes...
  • } chng {2000 May 29} {
  • Initial Public Release of Alpha code
  • } puts {


    Back to the SQLite Home Page

    } sqlite-2.8.17/test/0000755000175000001440000000000010232547612014027 5ustar drhusers00000000000000sqlite-2.8.17/test/CVS/0000755000175000001440000000000010251061265014456 5ustar drhusers00000000000000sqlite-2.8.17/test/CVS/Tag0000644000175000001440000000001310232547612015112 0ustar drhusers00000000000000Tversion_2 sqlite-2.8.17/test/CVS/Root0000644000175000001440000000004410232547612015326 0ustar drhusers00000000000000:pserver:drh@www.sqlite.org:/sqlite sqlite-2.8.17/test/CVS/Repository0000644000175000001440000000001410232547612016557 0ustar drhusers00000000000000sqlite/test sqlite-2.8.17/test/CVS/Entries0000644000175000001440000001105110251061265016010 0ustar drhusers00000000000000/all.test/1.19/Sat Apr 23 22:43:22 2005//Tversion_2 /attach.test/1.13/Sat Apr 23 22:43:22 2005//Tversion_2 /attach2.test/1.5/Sat Apr 23 22:43:22 2005//Tversion_2 /auth.test/1.12.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /bigfile.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /bigrow.test/1.4/Sat Apr 23 22:43:22 2005//Tversion_2 /bind.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /btree.test/1.15/Sat Apr 23 22:43:22 2005//Tversion_2 /btree2.test/1.10/Sat Apr 23 22:43:22 2005//Tversion_2 /btree3.test/1.2/Sat Apr 23 22:43:22 2005//Tversion_2 /btree3rb.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /btree4.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /btree4rb.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /capi2.test/1.10/Sat Apr 23 22:43:22 2005//Tversion_2 /conflict.test/1.19/Sat Apr 23 22:43:22 2005//Tversion_2 /copy.test/1.17/Sat Apr 23 22:43:22 2005//Tversion_2 /crashtest1.c/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /date.test/1.7.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /delete.test/1.13/Sat Apr 23 22:43:22 2005//Tversion_2 /expr.test/1.31/Sat Apr 23 22:43:22 2005//Tversion_2 /fkey1.test/1.2/Sat Apr 23 22:43:22 2005//Tversion_2 /format3.test/1.4/Sat Apr 23 22:43:22 2005//Tversion_2 /func.test/1.16.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /hook.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /in.test/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /index.test/1.24.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /insert.test/1.15/Sat Apr 23 22:43:22 2005//Tversion_2 /insert2.test/1.10/Sat Apr 23 22:43:22 2005//Tversion_2 /interrupt.test/1.4.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /intpkey.test/1.14/Sat Apr 23 22:43:22 2005//Tversion_2 /ioerr.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /join.test/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /join2.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /join3_28.test/1.1.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /join4_28.test/1.1.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /lastinsert.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /laststmtchanges.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /limit.test/1.11.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /lock.test/1.20/Sat Apr 23 22:43:22 2005//Tversion_2 /main.test/1.14/Sat Apr 23 22:43:22 2005//Tversion_2 /malloc.test/1.6/Sat Apr 23 22:43:22 2005//Tversion_2 /memdb.test/1.6/Sat Apr 23 22:43:22 2005//Tversion_2 /memleak.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /minmax.test/1.9.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /misc1.test/1.23/Sat Apr 23 22:43:22 2005//Tversion_2 /misc2.test/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /misc3.test/1.10/Sat Apr 23 22:43:22 2005//Tversion_2 /misuse.test/1.4/Sat Apr 23 22:43:22 2005//Tversion_2 /notnull.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /null.test/1.3.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /pager.test/1.14/Sat Apr 23 22:43:22 2005//Tversion_2 /pragma.test/1.9/Sat Apr 23 22:43:22 2005//Tversion_2 /printf.test/1.8/Sat Apr 23 22:43:22 2005//Tversion_2 /progress.test/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /quick.test/1.6/Sat Apr 23 22:43:22 2005//Tversion_2 /quote.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /rowid.test/1.13/Sat Apr 23 22:43:22 2005//Tversion_2 /select1.test/1.30.2.3/Sat Apr 23 22:43:22 2005//Tversion_2 /select2.test/1.18/Sat Apr 23 22:43:22 2005//Tversion_2 /select3.test/1.8/Sat Apr 23 22:43:22 2005//Tversion_2 /select4.test/1.13/Sat Apr 23 22:43:22 2005//Tversion_2 /select5.test/1.6/Sat Apr 23 22:43:22 2005//Tversion_2 /select6.test/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /sort.test/1.9/Sat Apr 23 22:43:22 2005//Tversion_2 /subselect.test/1.7/Sat Apr 23 22:43:22 2005//Tversion_2 /table.test/1.22/Sat Apr 23 22:43:22 2005//Tversion_2 /tableapi.test/1.7/Sat Apr 23 22:43:22 2005//Tversion_2 /tclsqlite.test/1.20.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /temptable.test/1.11/Sat Apr 23 22:43:22 2005//Tversion_2 /tester.tcl/1.28/Sat Apr 23 22:43:22 2005//Tversion_2 /thread1.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /threadtest1.c/1.2/Sat Apr 23 22:43:22 2005//Tversion_2 /threadtest2.c/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /trans.test/1.19/Sat Apr 23 22:43:22 2005//Tversion_2 /trigger1.test/1.14.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /trigger2.test/1.14/Sat Apr 23 22:43:22 2005//Tversion_2 /trigger3.test/1.7/Sat Apr 23 22:43:22 2005//Tversion_2 /trigger4.test/1.3/Sat Apr 23 22:43:22 2005//Tversion_2 /unique.test/1.7/Sat Apr 23 22:43:22 2005//Tversion_2 /update.test/1.15/Sat Apr 23 22:43:22 2005//Tversion_2 /vacuum.test/1.15/Sat Apr 23 22:43:22 2005//Tversion_2 /version.test/1.9/Sat Apr 23 22:43:22 2005//Tversion_2 /view.test/1.16.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /where.test/1.17/Sat Apr 23 22:43:22 2005//Tversion_2 D sqlite-2.8.17/test/rowid.test0000644000175000001440000004122710232547612016062 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the magic ROWID column that is # found on all tables. # # $Id: rowid.test,v 1.13 2004/01/14 21:59:24 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Basic ROWID functionality tests. # do_test rowid-1.1 { execsql { CREATE TABLE t1(x int, y int); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); SELECT x FROM t1 ORDER BY y; } } {1 3} do_test rowid-1.2 { set r [execsql {SELECT rowid FROM t1 ORDER BY x}] global x2rowid rowid2x set x2rowid(1) [lindex $r 0] set x2rowid(3) [lindex $r 1] set rowid2x($x2rowid(1)) 1 set rowid2x($x2rowid(3)) 3 llength $r } {2} do_test rowid-1.3 { global x2rowid set sql "SELECT x FROM t1 WHERE rowid==$x2rowid(1)" execsql $sql } {1} do_test rowid-1.4 { global x2rowid set sql "SELECT x FROM t1 WHERE rowid==$x2rowid(3)" execsql $sql } {3} do_test rowid-1.5 { global x2rowid set sql "SELECT x FROM t1 WHERE oid==$x2rowid(1)" execsql $sql } {1} do_test rowid-1.6 { global x2rowid set sql "SELECT x FROM t1 WHERE OID==$x2rowid(3)" execsql $sql } {3} do_test rowid-1.7 { global x2rowid set sql "SELECT x FROM t1 WHERE _rowid_==$x2rowid(1)" execsql $sql } {1} do_test rowid-1.7.1 { while 1 { set norow [expr {int(rand()*1000000)}] if {$norow!=$x2rowid(1) && $norow!=$x2rowid(3)} break } execsql "SELECT x FROM t1 WHERE rowid=$norow" } {} do_test rowid-1.8 { global x2rowid set v [execsql {SELECT x, oid FROM t1 order by x}] set v2 [list 1 $x2rowid(1) 3 $x2rowid(3)] expr {$v==$v2} } {1} do_test rowid-1.9 { global x2rowid set v [execsql {SELECT x, RowID FROM t1 order by x}] set v2 [list 1 $x2rowid(1) 3 $x2rowid(3)] expr {$v==$v2} } {1} do_test rowid-1.9 { global x2rowid set v [execsql {SELECT x, _rowid_ FROM t1 order by x}] set v2 [list 1 $x2rowid(1) 3 $x2rowid(3)] expr {$v==$v2} } {1} # We can insert or update the ROWID column. # do_test rowid-2.1 { catchsql { INSERT INTO t1(rowid,x,y) VALUES(1234,5,6); SELECT rowid, * FROM t1; } } {0 {1 1 2 2 3 4 1234 5 6}} do_test rowid-2.2 { catchsql { UPDATE t1 SET rowid=12345 WHERE x==1; SELECT rowid, * FROM t1 } } {0 {2 3 4 1234 5 6 12345 1 2}} do_test rowid-2.3 { catchsql { INSERT INTO t1(y,x,oid) VALUES(8,7,1235); SELECT rowid, * FROM t1 WHERE rowid>1000; } } {0 {1234 5 6 1235 7 8 12345 1 2}} do_test rowid-2.4 { catchsql { UPDATE t1 SET oid=12346 WHERE x==1; SELECT rowid, * FROM t1; } } {0 {2 3 4 1234 5 6 1235 7 8 12346 1 2}} do_test rowid-2.5 { catchsql { INSERT INTO t1(x,_rowid_,y) VALUES(9,1236,10); SELECT rowid, * FROM t1 WHERE rowid>1000; } } {0 {1234 5 6 1235 7 8 1236 9 10 12346 1 2}} do_test rowid-2.6 { catchsql { UPDATE t1 SET _rowid_=12347 WHERE x==1; SELECT rowid, * FROM t1 WHERE rowid>1000; } } {0 {1234 5 6 1235 7 8 1236 9 10 12347 1 2}} # But we can use ROWID in the WHERE clause of an UPDATE that does not # change the ROWID. # do_test rowid-2.7 { global x2rowid set sql "UPDATE t1 SET x=2 WHERE OID==$x2rowid(3)" execsql $sql execsql {SELECT x FROM t1 ORDER BY x} } {1 2 5 7 9} do_test rowid-2.8 { global x2rowid set sql "UPDATE t1 SET x=3 WHERE _rowid_==$x2rowid(3)" execsql $sql execsql {SELECT x FROM t1 ORDER BY x} } {1 3 5 7 9} # We cannot index by ROWID # do_test rowid-2.9 { set v [catch {execsql {CREATE INDEX idxt1 ON t1(rowid)}} msg] lappend v $msg } {1 {table t1 has no column named rowid}} do_test rowid-2.10 { set v [catch {execsql {CREATE INDEX idxt1 ON t1(_rowid_)}} msg] lappend v $msg } {1 {table t1 has no column named _rowid_}} do_test rowid-2.11 { set v [catch {execsql {CREATE INDEX idxt1 ON t1(oid)}} msg] lappend v $msg } {1 {table t1 has no column named oid}} do_test rowid-2.12 { set v [catch {execsql {CREATE INDEX idxt1 ON t1(x, rowid)}} msg] lappend v $msg } {1 {table t1 has no column named rowid}} # Columns defined in the CREATE statement override the buildin ROWID # column names. # do_test rowid-3.1 { execsql { CREATE TABLE t2(rowid int, x int, y int); INSERT INTO t2 VALUES(0,2,3); INSERT INTO t2 VALUES(4,5,6); INSERT INTO t2 VALUES(7,8,9); SELECT * FROM t2 ORDER BY x; } } {0 2 3 4 5 6 7 8 9} do_test rowid-3.2 { execsql {SELECT * FROM t2 ORDER BY rowid} } {0 2 3 4 5 6 7 8 9} do_test rowid-3.3 { execsql {SELECT rowid, x, y FROM t2 ORDER BY rowid} } {0 2 3 4 5 6 7 8 9} do_test rowid-3.4 { set r1 [execsql {SELECT _rowid_, rowid FROM t2 ORDER BY rowid}] foreach {a b c d e f} $r1 {} set r2 [execsql {SELECT _rowid_, rowid FROM t2 ORDER BY x DESC}] foreach {u v w x y z} $r2 {} expr {$u==$e && $w==$c && $y==$a} } {1} do_probtest rowid-3.5 { set r1 [execsql {SELECT _rowid_, rowid FROM t2 ORDER BY rowid}] foreach {a b c d e f} $r1 {} expr {$a!=$b && $c!=$d && $e!=$f} } {1} # Let's try some more complex examples, including some joins. # do_test rowid-4.1 { execsql { DELETE FROM t1; DELETE FROM t2; } for {set i 1} {$i<=50} {incr i} { execsql "INSERT INTO t1(x,y) VALUES($i,[expr {$i*$i}])" } execsql {INSERT INTO t2 SELECT _rowid_, x*y, y*y FROM t1} execsql {SELECT t2.y FROM t1, t2 WHERE t1.x==4 AND t1.rowid==t2.rowid} } {256} do_test rowid-4.2 { execsql {SELECT t2.y FROM t2, t1 WHERE t1.x==4 AND t1.rowid==t2.rowid} } {256} do_test rowid-4.2.1 { execsql {SELECT t2.y FROM t2, t1 WHERE t1.x==4 AND t1.oid==t2.rowid} } {256} do_test rowid-4.2.2 { execsql {SELECT t2.y FROM t2, t1 WHERE t1.x==4 AND t1._rowid_==t2.rowid} } {256} do_test rowid-4.2.3 { execsql {SELECT t2.y FROM t2, t1 WHERE t1.x==4 AND t2.rowid==t1.rowid} } {256} do_test rowid-4.2.4 { execsql {SELECT t2.y FROM t2, t1 WHERE t2.rowid==t1.oid AND t1.x==4} } {256} do_test rowid-4.2.5 { execsql {SELECT t2.y FROM t1, t2 WHERE t1.x==4 AND t1._rowid_==t2.rowid} } {256} do_test rowid-4.2.6 { execsql {SELECT t2.y FROM t1, t2 WHERE t1.x==4 AND t2.rowid==t1.rowid} } {256} do_test rowid-4.2.7 { execsql {SELECT t2.y FROM t1, t2 WHERE t2.rowid==t1.oid AND t1.x==4} } {256} do_test rowid-4.3 { execsql {CREATE INDEX idxt1 ON t1(x)} execsql {SELECT t2.y FROM t1, t2 WHERE t1.x==4 AND t1.rowid==t2.rowid} } {256} do_test rowid-4.3.1 { execsql {SELECT t2.y FROM t1, t2 WHERE t1.x==4 AND t1._rowid_==t2.rowid} } {256} do_test rowid-4.3.2 { execsql {SELECT t2.y FROM t1, t2 WHERE t2.rowid==t1.oid AND 4==t1.x} } {256} do_test rowid-4.4 { execsql {SELECT t2.y FROM t2, t1 WHERE t1.x==4 AND t1.rowid==t2.rowid} } {256} do_test rowid-4.4.1 { execsql {SELECT t2.y FROM t2, t1 WHERE t1.x==4 AND t1._rowid_==t2.rowid} } {256} do_test rowid-4.4.2 { execsql {SELECT t2.y FROM t2, t1 WHERE t2.rowid==t1.oid AND 4==t1.x} } {256} do_test rowid-4.5 { execsql {CREATE INDEX idxt2 ON t2(y)} set sqlite_search_count 0 concat [execsql { SELECT t1.x FROM t2, t1 WHERE t2.y==256 AND t1.rowid==t2.rowid }] $sqlite_search_count } {4 3} do_test rowid-4.5.1 { set sqlite_search_count 0 concat [execsql { SELECT t1.x FROM t2, t1 WHERE t1.OID==t2.rowid AND t2.y==81 }] $sqlite_search_count } {3 3} do_test rowid-4.6 { execsql { SELECT t1.x FROM t1, t2 WHERE t2.y==256 AND t1.rowid==t2.rowid } } {4} do_test rowid-5.1 { execsql {DELETE FROM t1 WHERE _rowid_ IN (SELECT oid FROM t1 WHERE x>8)} execsql {SELECT max(x) FROM t1} } {8} # Make sure a "WHERE rowid=X" clause works when there is no ROWID of X. # do_test rowid-6.1 { execsql { SELECT x FROM t1 } } {1 2 3 4 5 6 7 8} do_test rowid-6.2 { for {set ::norow 1} {1} {incr ::norow} { if {[execsql "SELECT x FROM t1 WHERE rowid=$::norow"]==""} break } execsql [subst { DELETE FROM t1 WHERE rowid=$::norow }] } {} do_test rowid-6.3 { execsql { SELECT x FROM t1 } } {1 2 3 4 5 6 7 8} # Beginning with version 2.3.4, SQLite computes rowids of new rows by # finding the maximum current rowid and adding one. It falls back to # the old random algorithm if the maximum rowid is the largest integer. # The following tests are for this new behavior. # do_test rowid-7.0 { execsql { DELETE FROM t1; DROP TABLE t2; DROP INDEX idxt1; INSERT INTO t1 VALUES(1,2); SELECT rowid, * FROM t1; } } {1 1 2} do_test rowid-7.1 { execsql { INSERT INTO t1 VALUES(99,100); SELECT rowid,* FROM t1 } } {1 1 2 2 99 100} do_test rowid-7.2 { execsql { CREATE TABLE t2(a INTEGER PRIMARY KEY, b); INSERT INTO t2(b) VALUES(55); SELECT * FROM t2; } } {1 55} do_test rowid-7.3 { execsql { INSERT INTO t2(b) VALUES(66); SELECT * FROM t2; } } {1 55 2 66} do_test rowid-7.4 { execsql { INSERT INTO t2(a,b) VALUES(1000000,77); INSERT INTO t2(b) VALUES(88); SELECT * FROM t2; } } {1 55 2 66 1000000 77 1000001 88} do_test rowid-7.5 { execsql { INSERT INTO t2(a,b) VALUES(2147483647,99); INSERT INTO t2(b) VALUES(11); SELECT b FROM t2 ORDER BY b; } } {11 55 66 77 88 99} do_test rowid-7.6 { execsql { SELECT b FROM t2 WHERE a NOT IN(1,2,1000000,1000001,2147483647); } } {11} do_test rowid-7.7 { execsql { INSERT INTO t2(b) VALUES(22); INSERT INTO t2(b) VALUES(33); INSERT INTO t2(b) VALUES(44); INSERT INTO t2(b) VALUES(55); SELECT b FROM t2 WHERE a NOT IN(1,2,1000000,1000001,2147483647) ORDER BY b; } } {11 22 33 44 55} do_test rowid-7.8 { execsql { DELETE FROM t2 WHERE a!=2; INSERT INTO t2(b) VALUES(111); SELECT * FROM t2; } } {2 66 3 111} # Make sure AFTER triggers that do INSERTs do not change the last_insert_rowid. # Ticket #290 # do_test rowid-8.1 { execsql { CREATE TABLE t3(a integer primary key); CREATE TABLE t4(x); INSERT INTO t4 VALUES(1); CREATE TRIGGER r3 AFTER INSERT on t3 FOR EACH ROW BEGIN INSERT INTO t4 VALUES(NEW.a+10); END; SELECT * FROM t3; } } {} do_test rowid-8.2 { execsql { SELECT rowid, * FROM t4; } } {1 1} do_test rowid-8.3 { execsql { INSERT INTO t3 VALUES(123); SELECT last_insert_rowid(); } } {123} do_test rowid-8.4 { execsql { SELECT * FROM t3; } } {123} do_test rowid-8.5 { execsql { SELECT rowid, * FROM t4; } } {1 1 2 133} do_test rowid-8.6 { execsql { INSERT INTO t3 VALUES(NULL); SELECT last_insert_rowid(); } } {124} do_test rowid-8.7 { execsql { SELECT * FROM t3; } } {123 124} do_test rowid-8.8 { execsql { SELECT rowid, * FROM t4; } } {1 1 2 133 3 134} # ticket #377: Comparison between integer primiary key and floating point # values. # do_test rowid-9.1 { execsql { SELECT * FROM t3 WHERE a<123.5 } } {123} do_test rowid-9.2 { execsql { SELECT * FROM t3 WHERE a<124.5 } } {123 124} do_test rowid-9.3 { execsql { SELECT * FROM t3 WHERE a>123.5 } } {124} do_test rowid-9.4 { execsql { SELECT * FROM t3 WHERE a>122.5 } } {123 124} do_test rowid-9.5 { execsql { SELECT * FROM t3 WHERE a==123.5 } } {} do_test rowid-9.6 { execsql { SELECT * FROM t3 WHERE a==123.000 } } {123} do_test rowid-9.7 { execsql { SELECT * FROM t3 WHERE a>100.5 AND a<200.5 } } {123 124} do_test rowid-9.8 { execsql { SELECT * FROM t3 WHERE a>'xyz'; } } {} do_test rowid-9.9 { execsql { SELECT * FROM t3 WHERE a<'xyz'; } } {123 124} do_test rowid-9.10 { execsql { SELECT * FROM t3 WHERE a>=122.9 AND a<=123.1 } } {123} # Ticket #567. Comparisons of ROWID or integery primary key against # floating point numbers still do not always work. # do_test rowid-10.1 { execsql { CREATE TABLE t5(a); INSERT INTO t5 VALUES(1); INSERT INTO t5 VALUES(2); INSERT INTO t5 SELECT a+2 FROM t5; INSERT INTO t5 SELECT a+4 FROM t5; SELECT rowid, * FROM t5; } } {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8} do_test rowid-10.2 { execsql {SELECT rowid, a FROM t5 WHERE rowid>=5.5} } {6 6 7 7 8 8} do_test rowid-10.3 { execsql {SELECT rowid, a FROM t5 WHERE rowid>=5.0} } {5 5 6 6 7 7 8 8} do_test rowid-10.4 { execsql {SELECT rowid, a FROM t5 WHERE rowid>5.5} } {6 6 7 7 8 8} do_test rowid-10.3.2 { execsql {SELECT rowid, a FROM t5 WHERE rowid>5.0} } {6 6 7 7 8 8} do_test rowid-10.5 { execsql {SELECT rowid, a FROM t5 WHERE 5.5<=rowid} } {6 6 7 7 8 8} do_test rowid-10.6 { execsql {SELECT rowid, a FROM t5 WHERE 5.5=rowid} } {1 1 2 2 3 3 4 4 5 5} do_test rowid-10.10 { execsql {SELECT rowid, a FROM t5 WHERE 5.5>rowid} } {1 1 2 2 3 3 4 4 5 5} do_test rowid-10.11 { execsql {SELECT rowid, a FROM t5 WHERE rowid>=5.5 ORDER BY rowid DESC} } {8 8 7 7 6 6} do_test rowid-10.11.2 { execsql {SELECT rowid, a FROM t5 WHERE rowid>=5.0 ORDER BY rowid DESC} } {8 8 7 7 6 6 5 5} do_test rowid-10.12 { execsql {SELECT rowid, a FROM t5 WHERE rowid>5.5 ORDER BY rowid DESC} } {8 8 7 7 6 6} do_test rowid-10.12.2 { execsql {SELECT rowid, a FROM t5 WHERE rowid>5.0 ORDER BY rowid DESC} } {8 8 7 7 6 6} do_test rowid-10.13 { execsql {SELECT rowid, a FROM t5 WHERE 5.5<=rowid ORDER BY rowid DESC} } {8 8 7 7 6 6} do_test rowid-10.14 { execsql {SELECT rowid, a FROM t5 WHERE 5.5=rowid ORDER BY rowid DESC} } {5 5 4 4 3 3 2 2 1 1} do_test rowid-10.18 { execsql {SELECT rowid, a FROM t5 WHERE 5.5>rowid ORDER BY rowid DESC} } {5 5 4 4 3 3 2 2 1 1} do_test rowid-10.30 { execsql { CREATE TABLE t6(a); INSERT INTO t6(rowid,a) SELECT -a,a FROM t5; SELECT rowid, * FROM t6; } } {-8 8 -7 7 -6 6 -5 5 -4 4 -3 3 -2 2 -1 1} do_test rowid-10.31.1 { execsql {SELECT rowid, a FROM t6 WHERE rowid>=-5.5} } {-5 5 -4 4 -3 3 -2 2 -1 1} do_test rowid-10.31.2 { execsql {SELECT rowid, a FROM t6 WHERE rowid>=-5.0} } {-5 5 -4 4 -3 3 -2 2 -1 1} do_test rowid-10.32.1 { execsql {SELECT rowid, a FROM t6 WHERE rowid>=-5.5 ORDER BY rowid DESC} } {-1 1 -2 2 -3 3 -4 4 -5 5} do_test rowid-10.32.1 { execsql {SELECT rowid, a FROM t6 WHERE rowid>=-5.0 ORDER BY rowid DESC} } {-1 1 -2 2 -3 3 -4 4 -5 5} do_test rowid-10.33 { execsql {SELECT rowid, a FROM t6 WHERE -5.5<=rowid} } {-5 5 -4 4 -3 3 -2 2 -1 1} do_test rowid-10.34 { execsql {SELECT rowid, a FROM t6 WHERE -5.5<=rowid ORDER BY rowid DESC} } {-1 1 -2 2 -3 3 -4 4 -5 5} do_test rowid-10.35.1 { execsql {SELECT rowid, a FROM t6 WHERE rowid>-5.5} } {-5 5 -4 4 -3 3 -2 2 -1 1} do_test rowid-10.35.2 { execsql {SELECT rowid, a FROM t6 WHERE rowid>-5.0} } {-4 4 -3 3 -2 2 -1 1} do_test rowid-10.36.1 { execsql {SELECT rowid, a FROM t6 WHERE rowid>-5.5 ORDER BY rowid DESC} } {-1 1 -2 2 -3 3 -4 4 -5 5} do_test rowid-10.36.2 { execsql {SELECT rowid, a FROM t6 WHERE rowid>-5.0 ORDER BY rowid DESC} } {-1 1 -2 2 -3 3 -4 4} do_test rowid-10.37 { execsql {SELECT rowid, a FROM t6 WHERE -5.5=rowid} } {-8 8 -7 7 -6 6} do_test rowid-10.42 { execsql {SELECT rowid, a FROM t6 WHERE -5.5>=rowid ORDER BY rowid DESC} } {-6 6 -7 7 -8 8} do_test rowid-10.43 { execsql {SELECT rowid, a FROM t6 WHERE rowid<-5.5} } {-8 8 -7 7 -6 6} do_test rowid-10.44 { execsql {SELECT rowid, a FROM t6 WHERE rowid<-5.5 ORDER BY rowid DESC} } {-6 6 -7 7 -8 8} do_test rowid-10.44 { execsql {SELECT rowid, a FROM t6 WHERE -5.5>rowid} } {-8 8 -7 7 -6 6} do_test rowid-10.46 { execsql {SELECT rowid, a FROM t6 WHERE -5.5>rowid ORDER BY rowid DESC} } {-6 6 -7 7 -8 8} # Comparison of rowid against string values. # do_test rowid-11.1 { execsql {SELECT rowid, a FROM t5 WHERE rowid>'abc'} } {} do_test rowid-11.2 { execsql {SELECT rowid, a FROM t5 WHERE rowid>='abc'} } {} do_test rowid-11.3 { execsql {SELECT rowid, a FROM t5 WHERE rowid<'abc'} } {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8} do_test rowid-11.4 { execsql {SELECT rowid, a FROM t5 WHERE rowid<='abc'} } {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8} finish_test sqlite-2.8.17/test/quote.test0000644000175000001440000000375010232547612016072 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is the ability to specify table and column names # as quoted strings. # # $Id: quote.test,v 1.3 2002/05/21 13:43:04 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table with a strange name and with strange column names. # do_test quote-1.0 { set r [catch { execsql {CREATE TABLE '@abc' ( '#xyz' int, '!pqr' text );} } msg] lappend r $msg } {0 {}} # Insert, update and query the table. # do_test quote-1.1 { set r [catch { execsql {INSERT INTO '@abc' VALUES(5,'hello')} } msg] lappend r $msg } {0 {}} do_test quote-1.2 { set r [catch { execsql {SELECT * FROM '@abc'} } msg ] lappend r $msg } {0 {5 hello}} do_test quote-1.3 { set r [catch { execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'} } msg ] lappend r $msg } {0 {hello 10}} do_test quote-1.3.1 { catchsql { SELECT '!pqr', '#xyz'+5 FROM '@abc' } } {0 {!pqr 5}} do_test quote-1.3.2 { catchsql { SELECT "!pqr", "#xyz"+5 FROM '@abc' } } {0 {hello 10}} do_test quote-1.3 { set r [catch { execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'} } msg ] lappend r $msg } {0 {hello 10}} do_test quote-1.4 { set r [catch { execsql {UPDATE '@abc' SET '#xyz'=11} } msg ] lappend r $msg } {0 {}} do_test quote-1.5 { set r [catch { execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'} } msg ] lappend r $msg } {0 {hello 16}} # Drop the table with the strange name. # do_test quote-1.6 { set r [catch { execsql {DROP TABLE '@abc'} } msg ] lappend r $msg } {0 {}} finish_test sqlite-2.8.17/test/unique.test0000644000175000001440000001210710232547612016237 0ustar drhusers00000000000000# 2001 September 27 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE UNIQUE INDEX statement, # and primary keys, and the UNIQUE constraint on table columns # # $Id: unique.test,v 1.7 2003/08/05 13:13:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to create a table with two primary keys. # (This is allowed in SQLite even that it is not valid SQL) # do_test unique-1.1 { catchsql { CREATE TABLE t1( a int PRIMARY KEY, b int PRIMARY KEY, c text ); } } {1 {table "t1" has more than one primary key}} do_test unique-1.1b { catchsql { CREATE TABLE t1( a int PRIMARY KEY, b int UNIQUE, c text ); } } {0 {}} do_test unique-1.2 { catchsql { INSERT INTO t1(a,b,c) VALUES(1,2,3) } } {0 {}} do_test unique-1.3 { catchsql { INSERT INTO t1(a,b,c) VALUES(1,3,4) } } {1 {column a is not unique}} do_test unique-1.4 { execsql { SELECT * FROM t1 ORDER BY a; } } {1 2 3} do_test unique-1.5 { catchsql { INSERT INTO t1(a,b,c) VALUES(3,2,4) } } {1 {column b is not unique}} do_test unique-1.6 { execsql { SELECT * FROM t1 ORDER BY a; } } {1 2 3} do_test unique-1.7 { catchsql { INSERT INTO t1(a,b,c) VALUES(3,4,5) } } {0 {}} do_test unique-1.8 { execsql { SELECT * FROM t1 ORDER BY a; } } {1 2 3 3 4 5} integrity_check unique-1.9 do_test unique-2.0 { execsql { DROP TABLE t1; CREATE TABLE t2(a int, b int); INSERT INTO t2(a,b) VALUES(1,2); INSERT INTO t2(a,b) VALUES(3,4); SELECT * FROM t2 ORDER BY a; } } {1 2 3 4} do_test unique-2.1 { catchsql { CREATE UNIQUE INDEX i2 ON t2(a) } } {0 {}} do_test unique-2.2 { catchsql { SELECT * FROM t2 ORDER BY a } } {0 {1 2 3 4}} do_test unique-2.3 { catchsql { INSERT INTO t2 VALUES(1,5); } } {1 {column a is not unique}} do_test unique-2.4 { catchsql { SELECT * FROM t2 ORDER BY a } } {0 {1 2 3 4}} do_test unique-2.5 { catchsql { DROP INDEX i2; SELECT * FROM t2 ORDER BY a; } } {0 {1 2 3 4}} do_test unique-2.6 { catchsql { INSERT INTO t2 VALUES(1,5) } } {0 {}} do_test unique-2.7 { catchsql { SELECT * FROM t2 ORDER BY a, b; } } {0 {1 2 1 5 3 4}} do_test unique-2.8 { catchsql { CREATE UNIQUE INDEX i2 ON t2(a); } } {1 {indexed columns are not unique}} do_test unique-2.9 { catchsql { CREATE INDEX i2 ON t2(a); } } {0 {}} integrity_check unique-2.10 # Test the UNIQUE keyword as used on two or more fields. # do_test unique-3.1 { catchsql { CREATE TABLE t3( a int, b int, c int, d int, unique(a,c,d) ); } } {0 {}} do_test unique-3.2 { catchsql { INSERT INTO t3(a,b,c,d) VALUES(1,2,3,4); SELECT * FROM t3 ORDER BY a,b,c,d; } } {0 {1 2 3 4}} do_test unique-3.3 { catchsql { INSERT INTO t3(a,b,c,d) VALUES(1,2,3,5); SELECT * FROM t3 ORDER BY a,b,c,d; } } {0 {1 2 3 4 1 2 3 5}} do_test unique-3.4 { catchsql { INSERT INTO t3(a,b,c,d) VALUES(1,4,3,5); SELECT * FROM t3 ORDER BY a,b,c,d; } } {1 {columns a, c, d are not unique}} integrity_check unique-3.5 # Make sure NULLs are distinct as far as the UNIQUE tests are # concerned. # do_test unique-4.1 { execsql { CREATE TABLE t4(a UNIQUE, b, c, UNIQUE(b,c)); INSERT INTO t4 VALUES(1,2,3); INSERT INTO t4 VALUES(NULL, 2, NULL); SELECT * FROM t4; } } {1 2 3 {} 2 {}} do_test unique-4.2 { catchsql { INSERT INTO t4 VALUES(NULL, 3, 4); } } {0 {}} do_test unique-4.3 { execsql { SELECT * FROM t4 } } {1 2 3 {} 2 {} {} 3 4} do_test unique-4.4 { catchsql { INSERT INTO t4 VALUES(2, 2, NULL); } } {0 {}} do_test unique-4.5 { execsql { SELECT * FROM t4 } } {1 2 3 {} 2 {} {} 3 4 2 2 {}} integrity_check unique-4.6 # Test the error message generation logic. In particular, make sure we # do not overflow the static buffer used to generate the error message. # do_test unique-5.1 { execsql { CREATE TABLE t5( first_column_with_long_name, second_column_with_long_name, third_column_with_long_name, fourth_column_with_long_name, fifth_column_with_long_name, sixth_column_with_long_name, UNIQUE( first_column_with_long_name, second_column_with_long_name, third_column_with_long_name, fourth_column_with_long_name, fifth_column_with_long_name, sixth_column_with_long_name ) ); INSERT INTO t5 VALUES(1,2,3,4,5,6); SELECT * FROM t5; } } {1 2 3 4 5 6} do_test unique-5.2 { catchsql { INSERT INTO t5 VALUES(1,2,3,4,5,6); } } {1 {columns first_column_with_long_name, second_column_with_long_name, third_column_with_long_name, fourth_column_with_long_name, fifth_column_with_long_name, ... are not unique}} finish_test sqlite-2.8.17/test/quick.test0000644000175000001440000000232010232547612016041 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file runs all tests. # # $Id: quick.test,v 1.6 2004/02/11 02:18:07 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl rename finish_test really_finish_test proc finish_test {} {} set ISQUICK 1 set EXCLUDE { all.test quick.test btree2.test malloc.test memleak.test misuse.test } if {[sqlite -has-codec]} { lappend EXCLUDE \ attach.test \ attach2.test \ auth.test \ format3.test \ version.test } foreach testfile [lsort -dictionary [glob $testdir/*.test]] { set tail [file tail $testfile] if {[lsearch -exact $EXCLUDE $tail]>=0} continue source $testfile catch {db close} if {$sqlite_open_file_count>0} { puts "$tail did not close all files: $sqlite_open_file_count" incr nErr lappend ::failList $tail } } source $testdir/misuse.test set sqlite_open_file_count 0 really_finish_test sqlite-2.8.17/test/progress.test0000755000175000001440000000543510232547612016606 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the 'progress callback'. # # $Id: progress.test,v 1.1 2003/10/18 09:37:27 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # execsql { BEGIN; CREATE TABLE t1(a); INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(3); INSERT INTO t1 VALUES(4); INSERT INTO t1 VALUES(5); INSERT INTO t1 VALUES(6); INSERT INTO t1 VALUES(7); INSERT INTO t1 VALUES(8); INSERT INTO t1 VALUES(9); INSERT INTO t1 VALUES(10); COMMIT; } # Test that the progress callback is invoked. do_test progress-1.0 { set counter 0 db progress 1 "[namespace code {incr counter}] ; expr 0" execsql { SELECT * FROM t1 } expr $counter > 1 } 1 # Test that the query is abandoned when the progress callback returns non-zero do_test progress1.1 { set counter 0 db progress 1 "[namespace code {incr counter}] ; expr 1" execsql { SELECT * FROM t1 } set counter } 1 # Test that the query is rolled back when the progress callback returns # non-zero. do_test progress1.2 { # This figures out how many opcodes it takes to copy 5 extra rows into t1. db progress 1 "[namespace code {incr five_rows}] ; expr 0" set five_rows 0 execsql { INSERT INTO t1 SELECT a+10 FROM t1 WHERE a < 6 } db progress 0 "" execsql { DELETE FROM t1 WHERE a > 10 } # Now set up the progress callback to abandon the query after the number of # opcodes to copy 5 rows. That way, when we try to copy 6 rows, we know # some data will have been inserted into the table by the time the progress # callback abandons the query. db progress $five_rows "expr 1" execsql { INSERT INTO t1 SELECT a+10 FROM t1 WHERE a < 7 } execsql { SELECT count(*) FROM t1 } } 10 # Test that an active transaction remains active and not rolled back after the # progress query abandons a query. do_test progress1.3 { db progress 0 "" execsql BEGIN execsql { INSERT INTO t1 VALUES(11) } db progress 1 "expr 1" execsql { INSERT INTO t1 VALUES(12) } db progress 0 "" execsql COMMIT execsql { SELECT count(*) FROM t1 } } 11 # Check that a value of 0 for N means no progress callback do_test progress1.4 { set counter 0 db progress 0 "[namespace code {incr counter}] ; expr 0" execsql { SELECT * FROM t1; } set counter } 0 db progress 0 "" finish_test sqlite-2.8.17/test/btree4rb.test0000644000175000001440000000440210232547612016441 0ustar drhusers00000000000000# 2002 December 03 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # This file focuses on testing the sqliteBtreeNext() and # sqliteBtreePrevious() procedures and making sure they are able # to step through an entire table from either direction. # # $Id: btree4rb.test,v 1.1 2003/04/20 23:45:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Open a test database. # set b1 [btree_open :memory:] btree_begin_transaction $::b1 set data {abcdefghijklmnopqrstuvwxyz0123456789} append data $data append data $data append data $data append data $data foreach N {10 100 1000} { btree_clear_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] do_test btree4rb-$N.1 { for {set i 1} {$i<=$N} {incr i} { btree_insert $::c1 [format k-%05d $i] $::data-$i } btree_first $::c1 btree_key $::c1 } {k-00001} do_test btree4rb-$N.2 { btree_data $::c1 } $::data-1 for {set i 2} {$i<=$N} {incr i} { do_test btree-$N.3.$i.1 { btree_next $::c1 } 0 do_test btree-$N.3.$i.2 { btree_key $::c1 } [format k-%05d $i] do_test btree-$N.3.$i.3 { btree_data $::c1 } $::data-$i } do_test btree4rb-$N.4 { btree_next $::c1 } 1 do_test btree4rb-$N.5 { btree_last $::c1 } 0 do_test btree4rb-$N.6 { btree_key $::c1 } [format k-%05d $N] do_test btree4rb-$N.7 { btree_data $::c1 } $::data-$N for {set i [expr {$N-1}]} {$i>=1} {incr i -1} { do_test btree4rb-$N.8.$i.1 { btree_prev $::c1 } 0 do_test btree4rb-$N.8.$i.2 { btree_key $::c1 } [format k-%05d $i] do_test btree4rb-$N.8.$i.3 { btree_data $::c1 } $::data-$i } do_test btree4rb-$N.9 { btree_prev $::c1 } 1 btree_close_cursor $::c1 } btree_rollback $::b1 btree_close $::b1 } ;# end if( not mem: and has pager_open command ); finish_test sqlite-2.8.17/test/join3_28.test0000644000175000001440000000174210232547612016267 0ustar drhusers00000000000000# 2002 May 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for joins, including outer joins, where # there are a large number of tables involved in the join. # # $Id: join3_28.test,v 1.1.2.1 2004/07/22 16:08:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl catch {unset result} set result {} for {set N 1} {$N<=40} {incr N} { lappend result $N do_test join3-1.$N { execsql "CREATE TABLE t${N}(x);" execsql "INSERT INTO t$N VALUES($N)" set sql "SELECT * FROM t1" for {set i 2} {$i<=$N} {incr i} {append sql ", t$i"} execsql $sql } $result } finish_test sqlite-2.8.17/test/version.test0000644000175000001440000001214610232547612016421 0ustar drhusers00000000000000# 2002 July 17 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the ability of the library to detect # past or future file format version numbers and respond appropriately. # # $Id: version.test,v 1.9 2004/02/12 19:01:05 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Current file format version set VX 4 # Create a new database # do_test version-1.1 { execsql { CREATE TABLE t1(x); INSERT INTO t1 VALUES(1); INSERT INTO t1 SELECT x+1 FROM t1; INSERT INTO t1 SELECT x+2 FROM t1; INSERT INTO t1 SELECT x+4 FROM t1; SELECT * FROM t1; } } {1 2 3 4 5 6 7 8} # Make sure the version number is set correctly # do_test version-1.2 { db close set ::bt [btree_open test.db] btree_begin_transaction $::bt set ::meta [btree_get_meta $::bt] btree_rollback $::bt lindex $::meta 2 } $VX # Increase the file_format number by one. Verify that the # file will refuse to open. # do_test version-1.3 { set m2 [lreplace $::meta 2 2 [expr {$::VX+1}]] btree_begin_transaction $::bt eval btree_update_meta $::bt $m2 btree_commit $::bt set rc [catch {sqlite db test.db} msg] lappend rc $msg } {1 {unsupported file format}} # Decrease the file_format number by one. Verify that the # file will open correctly. # do_test version-1.4 { set m2 [lreplace $::meta 2 2 [expr {$::VX-1}]] btree_begin_transaction $::bt eval btree_update_meta $::bt $m2 btree_commit $::bt sqlite db test.db execsql { SELECT * FROM t1; } } {1 2 3 4 5 6 7 8} # Set the file_format number to 2. This should cause the automatic # upgrade processing to run. # do_test version-1.5 { set m2 [lreplace $::meta 2 2 2] btree_begin_transaction $::bt eval btree_update_meta $::bt $m2 btree_commit $::bt sqlite db test.db execsql { SELECT * FROM t1; } } {1 2 3 4 5 6 7 8} do_test version-1.6 { set ::meta [btree_get_meta $::bt] lindex $::meta 2 } $VX # Add some triggers, views, and indices to the schema and make sure the # automatic upgrade still works. # do_test version-1.7 { execsql { CREATE INDEX i1 ON t1(x); DELETE FROM t1; CREATE TABLE t2(a INTEGER PRIMARY KEY, b UNIQUE, c); CREATE TABLE cnt(name,ins, del); INSERT INTO cnt VALUES('t1',0,0); INSERT INTO cnt VALUES('t2',0,0); CREATE TRIGGER r1 AFTER INSERT ON t1 FOR EACH ROW BEGIN UPDATE cnt SET ins=ins+1 WHERE name='t1'; END; CREATE TRIGGER r2 AFTER DELETE ON t1 FOR EACH ROW BEGIN UPDATE cnt SET del=del+1 WHERE name='t1'; END; CREATE TRIGGER r3 AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE cnt SET ins=ins+1 WHERE name='t2'; END; CREATE TRIGGER r4 AFTER DELETE ON t2 FOR EACH ROW BEGIN UPDATE cnt SET del=del+1 WHERE name='t2'; END; CREATE VIEW v1 AS SELECT x+100 FROM t1; CREATE VIEW v2 AS SELECT sum(ins), sum(del) FROM cnt; INSERT INTO t1 VALUES(1); INSERT INTO t1 SELECT x+1 FROM t1; INSERT INTO t1 SELECT x+2 FROM t1; INSERT INTO t1 SELECT x+4 FROM t1; SELECT * FROM t1; } } {1 2 3 4 5 6 7 8} do_test version-1.8 { execsql { SELECT * FROM v2; } } {8 0} do_test version-1.9 { execsql { SELECT * FROM cnt; } } {t1 8 0 t2 0 0} do_test version-1.10 { execsql { INSERT INTO t2 SELECT x*3, x*2, x FROM t1; SELECT * FROM t2; } } {3 2 1 6 4 2 9 6 3 12 8 4 15 10 5 18 12 6 21 14 7 24 16 8} do_test version-1.11 { execsql { SELECT * FROM cnt; } } {t1 8 0 t2 8 0} # Here we do the upgrade test. # do_test version-1.12 { db close set m2 [lreplace $::meta 2 2 2] btree_begin_transaction $::bt eval btree_update_meta $::bt $m2 btree_commit $::bt sqlite db test.db execsql { SELECT * FROM cnt; } } {t1 8 0 t2 8 0} do_test version-1.13 { execsql { SELECT * FROM v1; } } {101 102 103 104 105 106 107 108} do_test version-1.14 { execsql { SELECT * FROM v2; } } {16 0} # Try to do an upgrade where the database file is read-only # do_test version-2.1 { db close set m2 [lreplace $::meta 2 2 2] btree_begin_transaction $::bt eval btree_update_meta $::bt $m2 btree_commit $::bt btree_close $::bt catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} if {[file writable test.db]} { error "Unable to make the database file test.db readonly - rerun this test as an unprivileged user" } set rc [catch {sqlite db test.db} msg] lappend rc $msg } {1 {unable to upgrade database to the version 2.6 format: attempt to write a readonly database}} do_test version-2.2 { file delete -force test.db set fd [open test.db w] set txt "This is not a valid database file\n" while {[string length $txt]<4092} {append txt $txt} puts $fd $txt close $fd set rc [catch {sqlite db test.db} msg] lappend rc $msg } {1 {file is encrypted or is not a database}} finish_test sqlite-2.8.17/test/attach.test0000644000175000001440000003133510232547612016201 0ustar drhusers00000000000000# 2003 April 4 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: attach.test,v 1.13 2004/02/14 01:39:50 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl for {set i 2} {$i<=15} {incr i} { file delete -force test$i.db file delete -force test$i.db-journal } do_test attach-1.1 { execsql { CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); SELECT * FROM t1; } } {1 2 3 4} do_test attach-1.2 { sqlite db2 test2.db execsql { CREATE TABLE t2(x,y); INSERT INTO t2 VALUES(1,'x'); INSERT INTO t2 VALUES(2,'y'); SELECT * FROM t2; } db2 } {1 x 2 y} do_test attach-1.3 { execsql { ATTACH DATABASE 'test2.db' AS two; SELECT * FROM two.t2; } } {1 x 2 y} do_test attach-1.4 { execsql { SELECT * FROM t2; } } {1 x 2 y} do_test attach-1.5 { execsql { DETACH DATABASE two; SELECT * FROM t1; } } {1 2 3 4} do_test attach-1.6 { catchsql { SELECT * FROM t2; } } {1 {no such table: t2}} do_test attach-1.7 { catchsql { SELECT * FROM two.t2; } } {1 {no such table: two.t2}} do_test attach-1.8 { catchsql { ATTACH DATABASE 'test3.db' AS three; } } {1 {cannot attach empty database: three}} do_test attach-1.9 { catchsql { SELECT * FROM three.sqlite_master; } } {1 {no such table: three.sqlite_master}} do_test attach-1.10 { catchsql { DETACH DATABASE three; } } {1 {no such database: three}} do_test attach-1.11 { execsql { ATTACH 'test.db' AS db2; ATTACH 'test.db' AS db3; ATTACH 'test.db' AS db4; ATTACH 'test.db' AS db5; ATTACH 'test.db' AS db6; ATTACH 'test.db' AS db7; ATTACH 'test.db' AS db8; ATTACH 'test.db' AS db9; } } {} proc db_list {db} { set list {} foreach {idx name file} [execsql {PRAGMA database_list} $db] { lappend list $idx $name } return $list } do_test attach-1.11b { db_list db } {0 main 1 temp 2 db2 3 db3 4 db4 5 db5 6 db6 7 db7 8 db8 9 db9} do_test attach-1.12 { catchsql { ATTACH 'test.db' as db2; } } {1 {database db2 is already in use}} do_test attach-1.13 { catchsql { ATTACH 'test.db' as db5; } } {1 {database db5 is already in use}} do_test attach-1.14 { catchsql { ATTACH 'test.db' as db9; } } {1 {database db9 is already in use}} do_test attach-1.15 { catchsql { ATTACH 'test.db' as main; } } {1 {database main is already in use}} do_test attach-1.16 { catchsql { ATTACH 'test.db' as temp; } } {1 {database temp is already in use}} do_test attach-1.17 { catchsql { ATTACH 'test.db' as MAIN; } } {1 {database MAIN is already in use}} do_test attach-1.18 { catchsql { ATTACH 'test.db' as db10; ATTACH 'test.db' as db11; } } {0 {}} do_test attach-1.19 { catchsql { ATTACH 'test.db' as db12; } } {1 {too many attached databases - max 10}} do_test attach-1.20.1 { execsql { DETACH db5; } db_list db } {0 main 1 temp 2 db2 3 db3 4 db4 5 db11 6 db6 7 db7 8 db8 9 db9 10 db10} integrity_check attach-1.20.2 do_test attach-1.21 { catchsql { ATTACH 'test.db' as db12; } } {0 {}} do_test attach-1.22 { catchsql { ATTACH 'test.db' as db13; } } {1 {too many attached databases - max 10}} do_test attach-1.23 { catchsql { DETACH db14; } } {1 {no such database: db14}} do_test attach-1.24 { catchsql { DETACH db12; } } {0 {}} do_test attach-1.25 { catchsql { DETACH db12; } } {1 {no such database: db12}} do_test attach-1.26 { catchsql { DETACH main; } } {1 {cannot detach database main}} do_test attach-1.27 { catchsql { DETACH Temp; } } {1 {cannot detach database Temp}} do_test attach-1.28 { catchsql { DETACH db11; DETACH db10; DETACH db9; DETACH db8; DETACH db7; DETACH db6; DETACH db4; DETACH db3; DETACH db2; } } {0 {}} do_test attach-1.29 { db_list db } {0 main 1 temp} do_test attach-2.1 { execsql { CREATE TABLE tx(x1,x2,y1,y2); CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN INSERT INTO tx(x1,x2,y1,y2) VALUES(OLD.x,NEW.x,OLD.y,NEW.y); END; SELECT * FROM tx; } db2; } {} do_test attach-2.2 { execsql { UPDATE t2 SET x=x+10; SELECT * FROM tx; } db2; } {1 11 x x 2 12 y y} do_test attach-2.3 { execsql { CREATE TABLE tx(x1,x2,y1,y2); SELECT * FROM tx; } } {} do_test attach-2.4 { execsql { ATTACH 'test2.db' AS db2; } } {} do_test attach-2.5 { execsql { UPDATE db2.t2 SET x=x+10; SELECT * FROM db2.tx; } } {1 11 x x 2 12 y y 11 21 x x 12 22 y y} do_test attach-2.6 { execsql { SELECT * FROM main.tx; } } {} do_test attach-2.7 { execsql { SELECT type, name, tbl_name FROM db2.sqlite_master; } } {table t2 t2 table tx tx trigger r1 t2} do_test attach-2.8 { db_list db } {0 main 1 temp 2 db2} do_test attach-2.9 { execsql { CREATE INDEX i2 ON t2(x); SELECT * FROM t2 WHERE x>5; } db2 } {21 x 22 y} do_test attach-2.10 { execsql { SELECT type, name, tbl_name FROM sqlite_master; } db2 } {table t2 t2 table tx tx trigger r1 t2 index i2 t2} #do_test attach-2.11 { # catchsql { # SELECT * FROM t2 WHERE x>5; # } #} {1 {database schema has changed}} do_test attach-2.12 { db_list db } {0 main 1 temp 2 db2} do_test attach-2.13 { catchsql { SELECT * FROM t2 WHERE x>5; } } {0 {21 x 22 y}} do_test attach-2.14 { execsql { SELECT type, name, tbl_name FROM sqlite_master; } } {table t1 t1 table tx tx} do_test attach-2.15 { execsql { SELECT type, name, tbl_name FROM db2.sqlite_master; } } {table t2 t2 table tx tx trigger r1 t2 index i2 t2} do_test attach-2.16 { db close sqlite db test.db execsql { ATTACH 'test2.db' AS db2; SELECT type, name, tbl_name FROM db2.sqlite_master; } } {table t2 t2 table tx tx trigger r1 t2 index i2 t2} do_test attach-3.1 { db close db2 close sqlite db test.db sqlite db2 test2.db execsql { SELECT * FROM t1 } } {1 2 3 4} do_test attach-3.2 { catchsql { SELECT * FROM t2 } } {1 {no such table: t2}} do_test attach-3.3 { catchsql { ATTACH DATABASE 'test2.db' AS db2; SELECT * FROM t2 } } {0 {21 x 22 y}} # Even though main has a transaction, test2.db should not be locked. do_test attach-3.4 { execsql BEGIN catchsql { SELECT * FROM t2; } db2; } {0 {21 x 22 y}} # Reading from db2 should not lock test2.db do_test attach-3.5 { execsql {SELECT * FROM t2} catchsql { SELECT * FROM t2; } db2; } {0 {21 x 22 y}} # Making a change to db2 causes test2.ddb to become locked. do_test attach-3.6 { execsql { UPDATE t2 SET x=x+1 WHERE x=50; } catchsql { SELECT * FROM t2; } db2; } {1 {database is locked}} do_test attach-3.7 { execsql ROLLBACK execsql {SELECT * FROM t2} db2 } {21 x 22 y} do_test attach-3.8 { execsql BEGIN execsql BEGIN db2 catchsql {SELECT * FROM t2} } {1 {database is locked}} do_test attach-3.9 { catchsql {SELECT * FROM t2} db2 } {0 {21 x 22 y}} do_test attach-3.10 { execsql {SELECT * FROM t1} } {1 2 3 4} do_test attach-3.11 { catchsql {UPDATE t1 SET a=a+1} } {0 {}} do_test attach-3.12 { execsql {SELECT * FROM t1} } {2 2 4 4} do_test attach-3.13 { catchsql {UPDATE t2 SET x=x+1 WHERE x=50} } {1 {database is locked}} do_test attach-3.14 { # Unable to reinitialize the schema tables because the aux database # is still locked. catchsql {SELECT * FROM t1} } {1 {database is locked}} do_test attach-3.15 { execsql COMMIT db2 execsql {SELECT * FROM t1} } {1 2 3 4} # Ticket #323 do_test attach-4.1 { execsql {DETACH db2} db2 close sqlite db2 test2.db execsql { CREATE TABLE t3(x,y); CREATE UNIQUE INDEX t3i1 ON t3(x); INSERT INTO t3 VALUES(1,2); SELECT * FROM t3; } db2; } {1 2} do_test attach-4.2 { execsql { CREATE TABLE t3(a,b); CREATE UNIQUE INDEX t3i1b ON t3(a); INSERT INTO t3 VALUES(9,10); SELECT * FROM t3; } } {9 10} do_test attach-4.3 { execsql { ATTACH DATABASE 'test2.db' AS db2; SELECT * FROM db2.t3; } } {1 2} do_test attach-4.4 { execsql { SELECT * FROM main.t3; } } {9 10} do_test attach-4.5 { execsql { INSERT INTO db2.t3 VALUES(9,10); SELECT * FROM db2.t3; } } {1 2 9 10} do_test attach-4.6 { execsql { DETACH db2; } execsql { CREATE TABLE t4(x); CREATE TRIGGER t3r3 AFTER INSERT ON t3 BEGIN INSERT INTO t4 VALUES('db2.' || NEW.x); END; INSERT INTO t3 VALUES(6,7); SELECT * FROM t4; } db2 } {db2.6} do_test attach-4.7 { execsql { CREATE TABLE t4(y); CREATE TRIGGER t3r3 AFTER INSERT ON t3 BEGIN INSERT INTO t4 VALUES('main.' || NEW.a); END; INSERT INTO main.t3 VALUES(11,12); SELECT * FROM main.t4; } } {main.11} do_test attach-4.8 { execsql { ATTACH DATABASE 'test2.db' AS db2; INSERT INTO db2.t3 VALUES(13,14); SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4; } } {db2.6 db2.13 main.11} do_test attach-4.9 { execsql { INSERT INTO main.t3 VALUES(15,16); SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4; } } {db2.6 db2.13 main.11 main.15} do_test attach-4.10 { execsql { DETACH DATABASE db2; } execsql { CREATE VIEW v3 AS SELECT x*100+y FROM t3; SELECT * FROM v3; } db2 } {102 910 607 1314} do_test attach-4.11 { execsql { CREATE VIEW v3 AS SELECT a*100+b FROM t3; SELECT * FROM v3; } } {910 1112 1516} do_test attach-4.12 { execsql { ATTACH DATABASE 'test2.db' AS db2; SELECT * FROM db2.v3; } } {102 910 607 1314} do_test attach-4.13 { execsql { SELECT * FROM main.v3; } } {910 1112 1516} # Tests for the sqliteFix...() routines in attach.c # do_test attach-5.1 { db close sqlite db test.db db2 close file delete -force test2.db sqlite db2 test2.db catchsql { ATTACH DATABASE 'test.db' AS orig; CREATE TRIGGER r1 AFTER INSERT ON orig.t1 BEGIN; SELECT 'no-op'; END; } db2 } {1 {triggers may not be added to auxiliary database orig}} do_test attach-5.2 { catchsql { CREATE TABLE t5(x,y); CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT 'no-op'; END; } db2 } {0 {}} do_test attach-5.3 { catchsql { DROP TRIGGER r5; CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT 'no-op' FROM orig.t1; END; } db2 } {1 {trigger r5 cannot reference objects in database orig}} do_test attach-5.4 { catchsql { CREATE TEMP TABLE t6(p,q,r); CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT 'no-op' FROM temp.t6; END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} do_test attach-5.5 { catchsql { CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT 'no-op' || (SELECT * FROM temp.t6); END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} do_test attach-5.6 { catchsql { CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT 'no-op' FROM t1 WHERE x<(SELECT min(x) FROM temp.t6); END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} do_test attach-5.7 { catchsql { CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT 'no-op' FROM t1 GROUP BY 1 HAVING x<(SELECT min(x) FROM temp.t6); END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} do_test attach-5.7 { catchsql { CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN SELECT max(1,x,(SELECT min(x) FROM temp.t6)) FROM t1; END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} do_test attach-5.8 { catchsql { CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN INSERT INTO t1 VALUES((SELECT min(x) FROM temp.t6),5); END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} do_test attach-5.9 { catchsql { CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN DELETE FROM t1 WHERE x<(SELECT min(x) FROM temp.t6); END; } db2 } {1 {trigger r5 cannot reference objects in database temp}} # Check to make sure we get a sensible error if unable to open # the file that we are trying to attach. # do_test attach-6.1 { catchsql { ATTACH DATABASE 'no-such-file' AS nosuch; } } {1 {cannot attach empty database: nosuch}} file delete -force no-such-file if {$tcl_platform(platform)=="unix"} { do_test attach-6.2 { sqlite dbx cannot-read dbx eval {CREATE TABLE t1(a,b,c)} dbx close file attributes cannot-read -permission 0000 catchsql { ATTACH DATABASE 'cannot-read' AS noread; } } {1 {unable to open database: cannot-read}} file delete -force cannot-read } for {set i 2} {$i<=15} {incr i} { catch {db$i close} } file delete -force test2.db finish_test sqlite-2.8.17/test/sort.test0000644000175000001440000002210710232547612015721 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # # $Id: sort.test,v 1.9 2003/04/18 17:45:15 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a bunch of data to sort against # do_test sort-1.0 { set fd [open data.txt w] puts $fd "1\tone\t0\tI\t3.141592653" puts $fd "2\ttwo\t1\tII\t2.15" puts $fd "3\tthree\t1\tIII\t4221.0" puts $fd "4\tfour\t2\tIV\t-0.0013442" puts $fd "5\tfive\t2\tV\t-11" puts $fd "6\tsix\t2\tVI\t0.123" puts $fd "7\tseven\t2\tVII\t123.0" puts $fd "8\teight\t3\tVIII\t-1.6" close $fd execsql { CREATE TABLE t1( n int, v varchar(10), log int, roman varchar(10), flt real ); COPY t1 FROM 'data.txt' } file delete data.txt execsql {SELECT count(*) FROM t1} } {8} do_test sort-1.1 { execsql {SELECT n FROM t1 ORDER BY n} } {1 2 3 4 5 6 7 8} do_test sort-1.1.1 { execsql {SELECT n FROM t1 ORDER BY n ASC} } {1 2 3 4 5 6 7 8} do_test sort-1.1.1 { execsql {SELECT ALL n FROM t1 ORDER BY n ASC} } {1 2 3 4 5 6 7 8} do_test sort-1.2 { execsql {SELECT n FROM t1 ORDER BY n DESC} } {8 7 6 5 4 3 2 1} do_test sort-1.3a { execsql {SELECT v FROM t1 ORDER BY v} } {eight five four one seven six three two} do_test sort-1.3b { execsql {SELECT n FROM t1 ORDER BY v} } {8 5 4 1 7 6 3 2} do_test sort-1.4 { execsql {SELECT n FROM t1 ORDER BY v DESC} } {2 3 6 7 1 4 5 8} do_test sort-1.5 { execsql {SELECT flt FROM t1 ORDER BY flt} } {-11 -1.6 -0.0013442 0.123 2.15 3.141592653 123.0 4221.0} do_test sort-1.6 { execsql {SELECT flt FROM t1 ORDER BY flt DESC} } {4221.0 123.0 3.141592653 2.15 0.123 -0.0013442 -1.6 -11} do_test sort-1.7 { execsql {SELECT roman FROM t1 ORDER BY roman} } {I II III IV V VI VII VIII} do_test sort-1.8 { execsql {SELECT n FROM t1 ORDER BY log, flt} } {1 2 3 5 4 6 7 8} do_test sort-1.8.1 { execsql {SELECT n FROM t1 ORDER BY log asc, flt} } {1 2 3 5 4 6 7 8} do_test sort-1.8.2 { execsql {SELECT n FROM t1 ORDER BY log, flt ASC} } {1 2 3 5 4 6 7 8} do_test sort-1.8.3 { execsql {SELECT n FROM t1 ORDER BY log ASC, flt asc} } {1 2 3 5 4 6 7 8} do_test sort-1.9 { execsql {SELECT n FROM t1 ORDER BY log, flt DESC} } {1 3 2 7 6 4 5 8} do_test sort-1.9.1 { execsql {SELECT n FROM t1 ORDER BY log ASC, flt DESC} } {1 3 2 7 6 4 5 8} do_test sort-1.10 { execsql {SELECT n FROM t1 ORDER BY log DESC, flt} } {8 5 4 6 7 2 3 1} do_test sort-1.11 { execsql {SELECT n FROM t1 ORDER BY log DESC, flt DESC} } {8 7 6 4 5 3 2 1} # These tests are designed to reach some hard-to-reach places # inside the string comparison routines. # # (Later) The sorting behavior changed in 2.7.0. But we will # keep these tests. You can never have too many test cases! # do_test sort-2.1.1 { execsql { UPDATE t1 SET v='x' || -flt; UPDATE t1 SET v='x-2b' where v=='x-0.123'; SELECT v FROM t1 ORDER BY v; } } {x-123 x-2.15 x-2b x-3.141592653 x-4221 x0.0013442 x1.6 x11} do_test sort-2.1.2 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999); } } {x-123 x-2.15 x-2b x-3.141592653 x-4221 x0.0013442 x1.6 x11} do_test sort-2.1.3 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999)+0.0; } } {x-4221 x-123 x-3.141592653 x-2.15 x-2b x0.0013442 x1.6 x11} do_test sort-2.1.4 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999) DESC; } } {x11 x1.6 x0.0013442 x-4221 x-3.141592653 x-2b x-2.15 x-123} do_test sort-2.1.5 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999)+0.0 DESC; } } {x11 x1.6 x0.0013442 x-2b x-2.15 x-3.141592653 x-123 x-4221} # This is a bug fix for 2.2.4. # Strings are normally mapped to upper-case for a caseless comparison. # But this can cause problems for characters in between 'Z' and 'a'. # do_test sort-3.1 { execsql { CREATE TABLE t2(a,b); INSERT INTO t2 VALUES('AGLIENTU',1); INSERT INTO t2 VALUES('AGLIE`',2); INSERT INTO t2 VALUES('AGNA',3); SELECT a, b FROM t2 ORDER BY a; } } {AGLIENTU 1 AGLIE` 2 AGNA 3} do_test sort-3.2 { execsql { SELECT a, b FROM t2 ORDER BY a DESC; } } {AGNA 3 AGLIE` 2 AGLIENTU 1} do_test sort-3.3 { execsql { DELETE FROM t2; INSERT INTO t2 VALUES('aglientu',1); INSERT INTO t2 VALUES('aglie`',2); INSERT INTO t2 VALUES('agna',3); SELECT a, b FROM t2 ORDER BY a; } } {aglie` 2 aglientu 1 agna 3} do_test sort-3.4 { execsql { SELECT a, b FROM t2 ORDER BY a DESC; } } {agna 3 aglientu 1 aglie` 2} # Version 2.7.0 testing. # do_test sort-4.1 { execsql { INSERT INTO t1 VALUES(9,'x2.7',3,'IX',4.0e5); INSERT INTO t1 VALUES(10,'x5.0e10',3,'X',-4.0e5); INSERT INTO t1 VALUES(11,'x-4.0e9',3,'XI',4.1e4); INSERT INTO t1 VALUES(12,'x01234567890123456789',3,'XII',-4.2e3); SELECT n FROM t1 ORDER BY n; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test sort-4.2 { execsql { SELECT n||'' FROM t1 ORDER BY 1; } } {1 10 11 12 2 3 4 5 6 7 8 9} do_test sort-4.3 { execsql { SELECT n+0 FROM t1 ORDER BY 1; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test sort-4.4 { execsql { SELECT n||'' FROM t1 ORDER BY 1 DESC; } } {9 8 7 6 5 4 3 2 12 11 10 1} do_test sort-4.5 { execsql { SELECT n+0 FROM t1 ORDER BY 1 DESC; } } {12 11 10 9 8 7 6 5 4 3 2 1} do_test sort-4.6 { execsql { SELECT v FROM t1 ORDER BY 1; } } {x-123 x-2.15 x-2b x-3.141592653 x-4.0e9 x-4221 x0.0013442 x01234567890123456789 x1.6 x11 x2.7 x5.0e10} do_test sort-4.7 { execsql { SELECT v FROM t1 ORDER BY 1 DESC; } } {x5.0e10 x2.7 x11 x1.6 x01234567890123456789 x0.0013442 x-4221 x-4.0e9 x-3.141592653 x-2b x-2.15 x-123} do_test sort-4.8 { execsql { SELECT substr(v,2,99) FROM t1 ORDER BY 1; } } {-123 -2.15 -2b -3.141592653 -4.0e9 -4221 0.0013442 01234567890123456789 1.6 11 2.7 5.0e10} #do_test sort-4.9 { # execsql { # SELECT substr(v,2,99)+0.0 FROM t1 ORDER BY 1; # } #} {-4000000000 -4221 -123 -3.141592653 -2.15 -2 0.0013442 1.6 2.7 11 50000000000 1.23456789012346e+18} do_test sort-5.1 { execsql { create table t3(a,b); insert into t3 values(5,NULL); insert into t3 values(6,NULL); insert into t3 values(3,NULL); insert into t3 values(4,'cd'); insert into t3 values(1,'ab'); insert into t3 values(2,NULL); select a from t3 order by b, a; } } {2 3 5 6 1 4} do_test sort-5.2 { execsql { select a from t3 order by b, a desc; } } {6 5 3 2 1 4} do_test sort-5.3 { execsql { select a from t3 order by b desc, a; } } {4 1 2 3 5 6} do_test sort-5.4 { execsql { select a from t3 order by b desc, a desc; } } {4 1 6 5 3 2} do_test sort-6.1 { execsql { create index i3 on t3(b,a); select a from t3 order by b, a; } } {2 3 5 6 1 4} do_test sort-6.2 { execsql { select a from t3 order by b, a desc; } } {6 5 3 2 1 4} do_test sort-6.3 { execsql { select a from t3 order by b desc, a; } } {4 1 2 3 5 6} do_test sort-6.4 { execsql { select a from t3 order by b desc, a desc; } } {4 1 6 5 3 2} do_test sort-7.1 { execsql { CREATE TABLE t4( a INTEGER, b VARCHAR(30) ); INSERT INTO t4 VALUES(1,1); INSERT INTO t4 VALUES(2,2); INSERT INTO t4 VALUES(11,11); INSERT INTO t4 VALUES(12,12); SELECT a FROM t4 ORDER BY 1; } } {1 2 11 12} do_test sort-7.2 { execsql { SELECT b FROM t4 ORDER BY 1 } } {1 11 12 2} do_test sort-7.3 { execsql { CREATE VIEW v4 AS SELECT * FROM t4; SELECT a FROM v4 ORDER BY 1; } } {1 2 11 12} do_test sort-7.4 { execsql { SELECT b FROM v4 ORDER BY 1; } } {1 11 12 2} do_test sort-7.5 { execsql { SELECT a FROM t4 UNION SELECT a FROM v4 ORDER BY 1; } } {1 2 11 12} do_test sort-7.6 { execsql { SELECT b FROM t4 UNION SELECT a FROM v4 ORDER BY 1; } } {1 2 11 12} do_test sort-7.7 { execsql { SELECT a FROM t4 UNION SELECT b FROM v4 ORDER BY 1; } } {1 2 11 12} do_test sort-7.8 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1; } } {1 11 12 2} do_test sort-7.9 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE numeric; } } {1 2 11 12} do_test sort-7.10 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE integer; } } {1 2 11 12} do_test sort-7.11 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE text; } } {1 11 12 2} do_test sort-7.12 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE blob; } } {1 11 12 2} do_test sort-7.13 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE clob; } } {1 11 12 2} do_test sort-7.14 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE varchar; } } {1 11 12 2} # Ticket #297 # do_test sort-8.1 { execsql { CREATE TABLE t5(a real, b text); INSERT INTO t5 VALUES(100,'A1'); INSERT INTO t5 VALUES(100.0,'A2'); SELECT * FROM t5 ORDER BY a, b; } } {100 A1 100.0 A2} finish_test sqlite-2.8.17/test/tester.tcl0000644000175000001440000001520010232547612016037 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements some common TCL routines used for regression # testing the SQLite library # # $Id: tester.tcl,v 1.28 2004/02/14 01:39:50 drh Exp $ # Make sure tclsqlite was compiled correctly. Abort now with an # error message if not. # if {[sqlite -tcl-uses-utf]} { if {"\u1234"=="u1234"} { puts stderr "***** BUILD PROBLEM *****" puts stderr "$argv0 was linked against an older version" puts stderr "of TCL that does not support Unicode, but uses a header" puts stderr "file (\"tcl.h\") from a new TCL version that does support" puts stderr "Unicode. This combination causes internal errors." puts stderr "Recompile using a TCL library and header file that match" puts stderr "and try again.\n**************************" exit 1 } } else { if {"\u1234"!="u1234"} { puts stderr "***** BUILD PROBLEM *****" puts stderr "$argv0 was linked against an newer version" puts stderr "of TCL that supports Unicode, but uses a header file" puts stderr "(\"tcl.h\") from a old TCL version that does not support" puts stderr "Unicode. This combination causes internal errors." puts stderr "Recompile using a TCL library and header file that match" puts stderr "and try again.\n**************************" exit 1 } } # Use the pager codec if it is available # if {[sqlite -has-codec] && [info command sqlite_orig]==""} { rename sqlite sqlite_orig proc sqlite {args} { if {[llength $args]==2 && [string index [lindex $args 0] 0]!="-"} { lappend args -key {xyzzy} } uplevel 1 sqlite_orig $args } } # Create a test database # catch {db close} file delete -force test.db file delete -force test.db-journal sqlite db ./test.db if {[info exists ::SETUP_SQL]} { db eval $::SETUP_SQL } # Abort early if this script has been run before. # if {[info exists nTest]} return # Set the test counters to zero # set nErr 0 set nTest 0 set nProb 0 set skip_test 0 set failList {} # Invoke the do_test procedure to run a single test # proc do_test {name cmd expected} { global argv nErr nTest skip_test if {$skip_test} { set skip_test 0 return } if {[llength $argv]==0} { set go 1 } else { set go 0 foreach pattern $argv { if {[string match $pattern $name]} { set go 1 break } } } if {!$go} return incr nTest puts -nonewline $name... flush stdout if {[catch {uplevel #0 "$cmd;\n"} result]} { puts "\nError: $result" incr nErr lappend ::failList $name if {$nErr>100} {puts "*** Giving up..."; finalize_testing} } elseif {[string compare $result $expected]} { puts "\nExpected: \[$expected\]\n Got: \[$result\]" incr nErr lappend ::failList $name if {$nErr>100} {puts "*** Giving up..."; finalize_testing} } else { puts " Ok" } } # Invoke this procedure on a test that is probabilistic # and might fail sometimes. # proc do_probtest {name cmd expected} { global argv nProb nTest skip_test if {$skip_test} { set skip_test 0 return } if {[llength $argv]==0} { set go 1 } else { set go 0 foreach pattern $argv { if {[string match $pattern $name]} { set go 1 break } } } if {!$go} return incr nTest puts -nonewline $name... flush stdout if {[catch {uplevel #0 "$cmd;\n"} result]} { puts "\nError: $result" incr nErr } elseif {[string compare $result $expected]} { puts "\nExpected: \[$expected\]\n Got: \[$result\]" puts "NOTE: The results of the previous test depend on system load" puts "and processor speed. The test may sometimes fail even if the" puts "library is working correctly." incr nProb } else { puts " Ok" } } # The procedure uses the special "sqlite_malloc_stat" command # (which is only available if SQLite is compiled with -DMEMORY_DEBUG=1) # to see how many malloc()s have not been free()ed. The number # of surplus malloc()s is stored in the global variable $::Leak. # If the value in $::Leak grows, it may mean there is a memory leak # in the library. # proc memleak_check {} { if {[info command sqlite_malloc_stat]!=""} { set r [sqlite_malloc_stat] set ::Leak [expr {[lindex $r 0]-[lindex $r 1]}] } } # Run this routine last # proc finish_test {} { finalize_testing } proc finalize_testing {} { global nTest nErr nProb sqlite_open_file_count if {$nErr==0} memleak_check catch {db close} puts "$nErr errors out of $nTest tests" puts "Failures on these tests: $::failList" if {$nProb>0} { puts "$nProb probabilistic tests also failed, but this does" puts "not necessarily indicate a malfunction." } if {$sqlite_open_file_count} { puts "$sqlite_open_file_count files were left open" incr nErr } exit [expr {$nErr>0}] } # A procedure to execute SQL # proc execsql {sql {db db}} { # puts "SQL = $sql" return [$db eval $sql] } # Execute SQL and catch exceptions. # proc catchsql {sql {db db}} { # puts "SQL = $sql" set r [catch {$db eval $sql} msg] lappend r $msg return $r } # Do an VDBE code dump on the SQL given # proc explain {sql {db db}} { puts "" puts "addr opcode p1 p2 p3 " puts "---- ------------ ------ ------ ---------------" $db eval "explain $sql" {} { puts [format {%-4d %-12.12s %-6d %-6d %s} $addr $opcode $p1 $p2 $p3] } } # Another procedure to execute SQL. This one includes the field # names in the returned list. # proc execsql2 {sql} { set result {} db eval $sql data { foreach f $data(*) { lappend result $f $data($f) } } return $result } # Use the non-callback API to execute multiple SQL statements # proc stepsql {dbptr sql} { set sql [string trim $sql] set r 0 while {[string length $sql]>0} { if {[catch {sqlite_compile $dbptr $sql sqltail} vm]} { return [list 1 $vm] } set sql [string trim $sqltail] while {[sqlite_step $vm N VAL COL]=="SQLITE_ROW"} { foreach v $VAL {lappend r $v} } if {[catch {sqlite_finalize $vm} errmsg]} { return [list 1 $errmsg] } } return $r } # Delete a file or directory # proc forcedelete {filename} { if {[catch {file delete -force $filename}]} { exec rm -rf $filename } } # Do an integrity check of the entire database # proc integrity_check {name} { do_test $name { execsql {PRAGMA integrity_check} } {ok} } sqlite-2.8.17/test/temptable.test0000644000175000001440000002116610232547612016713 0ustar drhusers00000000000000# 2001 October 7 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for temporary tables and indices. # # $Id: temptable.test,v 1.11 2004/02/14 16:31:04 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create an alternative connection to the database # do_test temptable-1.0 { sqlite db2 ./test.db set dummy {} } {} # Create a permanent table. # do_test temptable-1.1 { execsql {CREATE TABLE t1(a,b,c);} execsql {INSERT INTO t1 VALUES(1,2,3);} execsql {SELECT * FROM t1} } {1 2 3} do_test temptable-1.2 { catch {db2 eval {SELECT * FROM sqlite_master}} db2 eval {SELECT * FROM t1} } {1 2 3} do_test temptable-1.3 { execsql {SELECT name FROM sqlite_master} } {t1} do_test temptable-1.4 { db2 eval {SELECT name FROM sqlite_master} } {t1} # Create a temporary table. Verify that only one of the two # processes can see it. # do_test temptable-1.5 { db2 eval { CREATE TEMP TABLE t2(x,y,z); INSERT INTO t2 VALUES(4,5,6); } db2 eval {SELECT * FROM t2} } {4 5 6} do_test temptable-1.6 { catch {execsql {SELECT * FROM sqlite_master}} catchsql {SELECT * FROM t2} } {1 {no such table: t2}} do_test temptable-1.7 { catchsql {INSERT INTO t2 VALUES(8,9,0);} } {1 {no such table: t2}} do_test temptable-1.8 { db2 eval {INSERT INTO t2 VALUES(8,9,0);} db2 eval {SELECT * FROM t2 ORDER BY x} } {4 5 6 8 9 0} do_test temptable-1.9 { db2 eval {DELETE FROM t2 WHERE x==8} db2 eval {SELECT * FROM t2 ORDER BY x} } {4 5 6} do_test temptable-1.10 { db2 eval {DELETE FROM t2} db2 eval {SELECT * FROM t2} } {} do_test temptable-1.11 { db2 eval { INSERT INTO t2 VALUES(7,6,5); INSERT INTO t2 VALUES(4,3,2); SELECT * FROM t2 ORDER BY x; } } {4 3 2 7 6 5} do_test temptable-1.12 { db2 eval {DROP TABLE t2;} set r [catch {db2 eval {SELECT * FROM t2}} msg] lappend r $msg } {1 {no such table: t2}} # Make sure temporary tables work with transactions # do_test temptable-2.1 { execsql { BEGIN TRANSACTION; CREATE TEMPORARY TABLE t2(x,y); INSERT INTO t2 VALUES(1,2); SELECT * FROM t2; } } {1 2} do_test temptable-2.2 { execsql {ROLLBACK} catchsql {SELECT * FROM t2} } {1 {no such table: t2}} do_test temptable-2.3 { execsql { BEGIN TRANSACTION; CREATE TEMPORARY TABLE t2(x,y); INSERT INTO t2 VALUES(1,2); SELECT * FROM t2; } } {1 2} do_test temptable-2.4 { execsql {COMMIT} catchsql {SELECT * FROM t2} } {0 {1 2}} do_test temptable-2.5 { set r [catch {db2 eval {SELECT * FROM t2}} msg] lappend r $msg } {1 {no such table: t2}} # Make sure indices on temporary tables are also temporary. # do_test temptable-3.1 { execsql { CREATE INDEX i2 ON t2(x); SELECT name FROM sqlite_master WHERE type='index'; } } {} do_test temptable-3.2 { execsql { SELECT y FROM t2 WHERE x=1; } } {2} do_test temptable-3.3 { execsql { DROP INDEX i2; SELECT y FROM t2 WHERE x=1; } } {2} do_test temptable-3.4 { execsql { CREATE INDEX i2 ON t2(x); DROP TABLE t2; } catchsql {DROP INDEX i2} } {1 {no such index: i2}} # Check for correct name collision processing. A name collision can # occur when process A creates a temporary table T then process B # creates a permanent table also named T. The temp table in process A # hides the existance of the permanent table. # do_test temptable-4.1 { execsql { CREATE TEMP TABLE t2(x,y); INSERT INTO t2 VALUES(10,20); SELECT * FROM t2; } db2 } {10 20} do_test temptable-4.2 { execsql { CREATE TABLE t2(x,y,z); INSERT INTO t2 VALUES(9,8,7); SELECT * FROM t2; } } {9 8 7} do_test temptable-4.3 { catchsql { SELECT * FROM t2; } db2 } {0 {10 20}} do_test temptable-4.4.1 { catchsql { SELECT * FROM temp.t2; } db2 } {0 {10 20}} do_test temptable-4.4.2 { catchsql { SELECT * FROM main.t2; } db2 } {1 {no such table: main.t2}} #do_test temptable-4.4.3 { # catchsql { # SELECT name FROM main.sqlite_master WHERE type='table'; # } db2 #} {1 {database schema has changed}} do_test temptable-4.4.4 { catchsql { SELECT name FROM main.sqlite_master WHERE type='table'; } db2 } {0 {t1 t2}} do_test temptable-4.4.5 { catchsql { SELECT * FROM main.t2; } db2 } {0 {9 8 7}} do_test temptable-4.4.6 { # TEMP takes precedence over MAIN catchsql { SELECT * FROM t2; } db2 } {0 {10 20}} do_test temptable-4.5 { catchsql { DROP TABLE t2; -- should drop TEMP SELECT * FROM t2; -- data should be from MAIN } db2 } {0 {9 8 7}} do_test temptable-4.6 { db2 close sqlite db2 ./test.db catchsql { SELECT * FROM t2; } db2 } {0 {9 8 7}} do_test temptable-4.7 { catchsql { DROP TABLE t2; SELECT * FROM t2; } } {1 {no such table: t2}} do_test temptable-4.8 { db2 close sqlite db2 ./test.db execsql { CREATE TEMP TABLE t2(x unique,y); INSERT INTO t2 VALUES(1,2); SELECT * FROM t2; } db2 } {1 2} do_test temptable-4.9 { execsql { CREATE TABLE t2(x unique, y); INSERT INTO t2 VALUES(3,4); SELECT * FROM t2; } } {3 4} do_test temptable-4.10.1 { catchsql { SELECT * FROM t2; } db2 } {0 {1 2}} #do_test temptable-4.10.2 { # catchsql { # SELECT name FROM sqlite_master WHERE type='table' # } db2 #} {1 {database schema has changed}} do_test temptable-4.10.3 { catchsql { SELECT name FROM sqlite_master WHERE type='table' } db2 } {0 {t1 t2}} do_test temptable-4.11 { execsql { SELECT * FROM t2; } db2 } {1 2} do_test temptable-4.12 { execsql { SELECT * FROM t2; } } {3 4} do_test temptable-4.13 { catchsql { DROP TABLE t2; -- drops TEMP.T2 SELECT * FROM t2; -- uses MAIN.T2 } db2 } {0 {3 4}} do_test temptable-4.14 { execsql { SELECT * FROM t2; } } {3 4} do_test temptable-4.15 { db2 close sqlite db2 ./test.db execsql { SELECT * FROM t2; } db2 } {3 4} # Now create a temporary table in db2 and a permanent index in db. The # temporary table in db2 should mask the name of the permanent index, # but the permanent index should still be accessible and should still # be updated when its corresponding table changes. # do_test temptable-5.1 { execsql { CREATE TEMP TABLE mask(a,b,c) } db2 execsql { CREATE INDEX mask ON t2(x); SELECT * FROM t2; } } {3 4} #do_test temptable-5.2 { # catchsql { # SELECT * FROM t2; # } db2 #} {1 {database schema has changed}} do_test temptable-5.3 { catchsql { SELECT * FROM t2; } db2 } {0 {3 4}} do_test temptable-5.4 { execsql { SELECT y FROM t2 WHERE x=3 } } {4} do_test temptable-5.5 { execsql { SELECT y FROM t2 WHERE x=3 } db2 } {4} do_test temptable-5.6 { execsql { INSERT INTO t2 VALUES(1,2); SELECT y FROM t2 WHERE x=1; } db2 } {2} do_test temptable-5.7 { execsql { SELECT y FROM t2 WHERE x=3 } db2 } {4} do_test temptable-5.8 { execsql { SELECT y FROM t2 WHERE x=1; } } {2} do_test temptable-5.9 { execsql { SELECT y FROM t2 WHERE x=3 } } {4} db2 close # Test for correct operation of read-only databases # do_test temptable-6.1 { execsql { CREATE TABLE t8(x); INSERT INTO t8 VALUES('xyzzy'); SELECT * FROM t8; } } {xyzzy} do_test temptable-6.2 { db close catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} sqlite db test.db if {[file writable test.db]} { error "Unable to make the database file test.db readonly - rerun this test as an unprivileged user" } execsql { SELECT * FROM t8; } } {xyzzy} do_test temptable-6.3 { if {[file writable test.db]} { error "Unable to make the database file test.db readonly - rerun this test as an unprivileged user" } catchsql { CREATE TABLE t9(x,y); } } {1 {attempt to write a readonly database}} do_test temptable-6.4 { catchsql { CREATE TEMP TABLE t9(x,y); } } {0 {}} do_test temptable-6.5 { catchsql { INSERT INTO t9 VALUES(1,2); SELECT * FROM t9; } } {0 {1 2}} do_test temptable-6.6 { if {[file writable test.db]} { error "Unable to make the database file test.db readonly - rerun this test as an unprivileged user" } catchsql { INSERT INTO t8 VALUES('hello'); SELECT * FROM t8; } } {1 {attempt to write a readonly database}} do_test temptable-6.7 { catchsql { SELECT * FROM t8,t9; } } {0 {xyzzy 1 2}} do_test temptable-6.8 { db close sqlite db test.db catchsql { SELECT * FROM t8,t9; } } {1 {no such table: t9}} finish_test sqlite-2.8.17/test/limit.test0000644000175000001440000002003310232547612016044 0ustar drhusers00000000000000# 2001 November 6 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the LIMIT ... OFFSET ... clause # of SELECT statements. # # $Id: limit.test,v 1.11.2.1 2004/07/19 23:33:04 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # set fd [open data1.txt w] for {set i 1} {$i<=32} {incr i} { for {set j 0} {pow(2,$j)<$i} {incr j} {} puts $fd "[expr {32-$i}]\t[expr {10-$j}]" } close $fd execsql { CREATE TABLE t1(x int, y int); COPY t1 FROM 'data1.txt' } file delete data1.txt do_test limit-1.0 { execsql {SELECT count(*) FROM t1} } {32} do_test limit-1.1 { execsql {SELECT count(*) FROM t1 LIMIT 5} } {32} do_test limit-1.2.1 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 5} } {0 1 2 3 4} do_test limit-1.2.2 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 5 OFFSET 2} } {2 3 4 5 6} do_test limit-1.2.3 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 2, 5} } {2 3 4 5 6} do_test limit-1.3 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 5 OFFSET 5} } {5 6 7 8 9} do_test limit-1.4.1 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 50 OFFSET 30} } {30 31} do_test limit-1.4.2 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 30, 50} } {30 31} do_test limit-1.5 { execsql {SELECT x FROM t1 ORDER BY x LIMIT 50 OFFSET 50} } {} do_test limit-1.6 { execsql {SELECT * FROM t1 AS a, t1 AS b ORDER BY a.x, b.x LIMIT 5} } {0 5 0 5 0 5 1 5 0 5 2 5 0 5 3 5 0 5 4 5} do_test limit-1.7 { execsql {SELECT * FROM t1 AS a, t1 AS b ORDER BY a.x, b.x LIMIT 5 OFFSET 32} } {1 5 0 5 1 5 1 5 1 5 2 5 1 5 3 5 1 5 4 5} do_test limit-2.1 { execsql { CREATE VIEW v1 AS SELECT * FROM t1 LIMIT 2; SELECT count(*) FROM (SELECT * FROM v1); } } 2 do_test limit-2.2 { execsql { CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 2; SELECT count(*) FROM t2; } } 2 do_test limit-2.3 { execsql { SELECT count(*) FROM t1 WHERE rowid IN (SELECT rowid FROM t1 LIMIT 2); } } 2 do_test limit-3.1 { execsql { SELECT z FROM (SELECT y*10+x AS z FROM t1 ORDER BY x LIMIT 10) ORDER BY z LIMIT 5; } } {50 51 52 53 54} do_test limit-4.1 { execsql { BEGIN; CREATE TABLE t3(x); INSERT INTO t3 SELECT x FROM t1 ORDER BY x LIMIT 10 OFFSET 1; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; INSERT INTO t3 SELECT x+(SELECT max(x) FROM t3) FROM t3; END; SELECT count(*) FROM t3; } } {10240} do_test limit-4.2 { execsql { SELECT x FROM t3 LIMIT 2 OFFSET 10000 } } {10001 10002} do_test limit-4.3 { execsql { CREATE TABLE t4 AS SELECT x, 'abcdefghijklmnopqrstuvwyxz ABCDEFGHIJKLMNOPQRSTUVWYXZ' || x || 'abcdefghijklmnopqrstuvwyxz ABCDEFGHIJKLMNOPQRSTUVWYXZ' || x || 'abcdefghijklmnopqrstuvwyxz ABCDEFGHIJKLMNOPQRSTUVWYXZ' || x || 'abcdefghijklmnopqrstuvwyxz ABCDEFGHIJKLMNOPQRSTUVWYXZ' || x || 'abcdefghijklmnopqrstuvwyxz ABCDEFGHIJKLMNOPQRSTUVWYXZ' || x AS y FROM t3 LIMIT 1000; SELECT x FROM t4 ORDER BY y DESC LIMIT 1 OFFSET 999; } } {1000} do_test limit-5.1 { execsql { CREATE TABLE t5(x,y); INSERT INTO t5 SELECT x-y, x+y FROM t1 WHERE x BETWEEN 10 AND 15 ORDER BY x LIMIT 2; SELECT * FROM t5 ORDER BY x; } } {5 15 6 16} do_test limit-5.2 { execsql { DELETE FROM t5; INSERT INTO t5 SELECT x-y, x+y FROM t1 WHERE x BETWEEN 10 AND 15 ORDER BY x DESC LIMIT 2; SELECT * FROM t5 ORDER BY x; } } {9 19 10 20} do_test limit-5.3 { execsql { DELETE FROM t5; INSERT INTO t5 SELECT x-y, x+y FROM t1 WHERE x ORDER BY x DESC LIMIT 31; SELECT * FROM t5 ORDER BY x LIMIT 2; } } {-4 6 -3 7} do_test limit-5.4 { execsql { SELECT * FROM t5 ORDER BY x DESC, y DESC LIMIT 2; } } {21 41 21 39} do_test limit-5.5 { execsql { DELETE FROM t5; INSERT INTO t5 SELECT a.x*100+b.x, a.y*100+b.y FROM t1 AS a, t1 AS b ORDER BY 1, 2 LIMIT 1000; SELECT count(*), sum(x), sum(y), min(x), max(x), min(y), max(y) FROM t5; } } {1000 1528204 593161 0 3107 505 1005} # There is some contraversy about whether LIMIT 0 should be the same as # no limit at all or if LIMIT 0 should result in zero output rows. # do_test limit-6.1 { execsql { BEGIN; CREATE TABLE t6(a); INSERT INTO t6 VALUES(1); INSERT INTO t6 VALUES(2); INSERT INTO t6 SELECT a+2 FROM t6; COMMIT; SELECT * FROM t6; } } {1 2 3 4} do_test limit-6.2 { execsql { SELECT * FROM t6 LIMIT -1 OFFSET -1; } } {1 2 3 4} do_test limit-6.3 { execsql { SELECT * FROM t6 LIMIT 2 OFFSET -123; } } {1 2} do_test limit-6.4 { execsql { SELECT * FROM t6 LIMIT -432 OFFSET 2; } } {3 4} do_test limit-6.5 { execsql { SELECT * FROM t6 LIMIT -1 } } {1 2 3 4} do_test limit-6.6 { execsql { SELECT * FROM t6 LIMIT -1 OFFSET 1 } } {2 3 4} do_test limit-6.7 { execsql { SELECT * FROM t6 LIMIT 0 } } {} do_test limit-6.8 { execsql { SELECT * FROM t6 LIMIT 0 OFFSET 1 } } {} # Make sure LIMIT works well with compound SELECT statements. # Ticket #393 # do_test limit-7.1.1 { catchsql { SELECT x FROM t2 LIMIT 5 UNION ALL SELECT a FROM t6; } } {1 {LIMIT clause should come after UNION ALL not before}} do_test limit-7.1.2 { catchsql { SELECT x FROM t2 LIMIT 5 UNION SELECT a FROM t6; } } {1 {LIMIT clause should come after UNION not before}} do_test limit-7.1.3 { catchsql { SELECT x FROM t2 LIMIT 5 EXCEPT SELECT a FROM t6 LIMIT 3; } } {1 {LIMIT clause should come after EXCEPT not before}} do_test limit-7.1.4 { catchsql { SELECT x FROM t2 LIMIT 0,5 INTERSECT SELECT a FROM t6; } } {1 {LIMIT clause should come after INTERSECT not before}} do_test limit-7.2 { execsql { SELECT x FROM t2 UNION ALL SELECT a FROM t6 LIMIT 5; } } {31 30 1 2 3} do_test limit-7.3 { execsql { SELECT x FROM t2 UNION ALL SELECT a FROM t6 LIMIT 3 OFFSET 1; } } {30 1 2} do_test limit-7.4 { execsql { SELECT x FROM t2 UNION ALL SELECT a FROM t6 ORDER BY 1 LIMIT 3 OFFSET 1; } } {2 3 4} do_test limit-7.5 { execsql { SELECT x FROM t2 UNION SELECT x+2 FROM t2 LIMIT 2 OFFSET 1; } } {31 32} do_test limit-7.6 { execsql { SELECT x FROM t2 UNION SELECT x+2 FROM t2 ORDER BY 1 DESC LIMIT 2 OFFSET 1; } } {32 31} do_test limit-7.7 { execsql { SELECT a+9 FROM t6 EXCEPT SELECT y FROM t2 LIMIT 2; } } {11 12} do_test limit-7.8 { execsql { SELECT a+9 FROM t6 EXCEPT SELECT y FROM t2 ORDER BY 1 DESC LIMIT 2; } } {13 12} do_test limit-7.9 { execsql { SELECT a+26 FROM t6 INTERSECT SELECT x FROM t2 LIMIT 1; } } {30} do_test limit-7.10 { execsql { SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2 LIMIT 1; } } {30} do_test limit-7.11 { execsql { SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2 LIMIT 1 OFFSET 1; } } {31} do_test limit-7.12 { execsql { SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2 ORDER BY 1 DESC LIMIT 1 OFFSET 1; } } {30} # Tests for limit in conjunction with distinct. The distinct should # occur before both the limit and the offset. Ticket #749. # do_test limit-8.1 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5; } } {0 1 2 3 4} do_test limit-8.2 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 5; } } {5 6 7 8 9} do_test limit-8.3 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 25; } } {25 26 27 28 29} finish_test sqlite-2.8.17/test/memdb.test0000644000175000001440000002610410232547612016017 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is in-memory database backend. # # $Id: memdb.test,v 1.6 2003/08/05 13:13:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # In the following sequence of tests, compute the MD5 sum of the content # of a table, make lots of modifications to that table, then do a rollback. # Verify that after the rollback, the MD5 checksum is unchanged. # # These tests were browed from trans.tcl. # do_test memdb-1.1 { db close sqlite db :memory: # sqlite db test.db execsql { BEGIN; CREATE TABLE t3(x TEXT); INSERT INTO t3 VALUES(randstr(10,400)); INSERT INTO t3 VALUES(randstr(10,400)); INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; COMMIT; SELECT count(*) FROM t3; } } {1024} # The following procedure computes a "signature" for table "t3". If # T3 changes in any way, the signature should change. # # This is used to test ROLLBACK. We gather a signature for t3, then # make lots of changes to t3, then rollback and take another signature. # The two signatures should be the same. # proc signature {{fn {}}} { set rx [db eval {SELECT x FROM t3}] # set r1 [md5 $rx\n] if {$fn!=""} { # set fd [open $fn w] # puts $fd $rx # close $fd } # set r [db eval {SELECT count(*), md5sum(x) FROM t3}] # puts "SIG($fn)=$r1" return [list [string length $rx] $rx] } # Do rollbacks. Make sure the signature does not change. # set limit 10 for {set i 2} {$i<=$limit} {incr i} { set ::sig [signature one] # puts "sig=$sig" set cnt [lindex $::sig 0] set ::journal_format [expr {($i%3)+1}] if {$i%2==0} { execsql {PRAGMA synchronous=FULL} } else { execsql {PRAGMA synchronous=NORMAL} } do_test memdb-1.$i.1-$cnt { execsql { BEGIN; DELETE FROM t3 WHERE random()%10!=0; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; ROLLBACK; } set sig2 [signature two] } $sig # puts "sig2=$sig2" # if {$sig2!=$sig} exit do_test memdb-1.$i.2-$cnt { execsql { BEGIN; DELETE FROM t3 WHERE random()%10!=0; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; DELETE FROM t3 WHERE random()%10!=0; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; ROLLBACK; } signature } $sig if {$i<$limit} { do_test memdb-1.$i.9-$cnt { execsql { INSERT INTO t3 SELECT randstr(10,400) FROM t3 WHERE random()%10==0; } } {} } set ::pager_old_format 0 } do_test memdb-2.1 { execsql { PRAGMA integrity_check } } {ok} do_test memdb-3.1 { execsql { CREATE TABLE t4(a,b,c,d); BEGIN; INSERT INTO t4 VALUES(1,2,3,4); SELECT * FROM t4; } } {1 2 3 4} do_test memdb-3.2 { execsql { SELECT name FROM sqlite_master WHERE type='table'; } } {t3 t4} do_test memdb-3.3 { execsql { DROP TABLE t4; SELECT name FROM sqlite_master WHERE type='table'; } } {t3} do_test memdb-3.4 { execsql { ROLLBACK; SELECT name FROM sqlite_master WHERE type='table'; } } {t3 t4} # Create tables for the first group of tests. # do_test memdb-4.0 { execsql { CREATE TABLE t1(a, b, c, UNIQUE(a,b)); CREATE TABLE t2(x); SELECT c FROM t1 ORDER BY c; } } {} # Six columns of configuration data as follows: # # i The reference number of the test # conf The conflict resolution algorithm on the BEGIN statement # cmd An INSERT or REPLACE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "c" column of t1 assuming no error in $cmd # t2 Content of "x" column of t2 # foreach {i conf cmd t0 t1 t2} { 1 {} INSERT 1 {} 1 2 {} {INSERT OR IGNORE} 0 3 1 3 {} {INSERT OR REPLACE} 0 4 1 4 {} REPLACE 0 4 1 5 {} {INSERT OR FAIL} 1 {} 1 6 {} {INSERT OR ABORT} 1 {} 1 7 {} {INSERT OR ROLLBACK} 1 {} {} 8 IGNORE INSERT 0 3 1 9 IGNORE {INSERT OR IGNORE} 0 3 1 10 IGNORE {INSERT OR REPLACE} 0 4 1 11 IGNORE REPLACE 0 4 1 12 IGNORE {INSERT OR FAIL} 1 {} 1 13 IGNORE {INSERT OR ABORT} 1 {} 1 14 IGNORE {INSERT OR ROLLBACK} 1 {} {} 15 REPLACE INSERT 0 4 1 16 FAIL INSERT 1 {} 1 17 ABORT INSERT 1 {} 1 18 ROLLBACK INSERT 1 {} {} } { do_test memdb-4.$i { if {$conf!=""} {set conf "ON CONFLICT $conf"} set r0 [catch {execsql [subst { DELETE FROM t1; DELETE FROM t2; INSERT INTO t1 VALUES(1,2,3); BEGIN $conf; INSERT INTO t2 VALUES(1); $cmd INTO t1 VALUES(1,2,4); }]} r1] catch {execsql {COMMIT}} if {$r0} {set r1 {}} {set r1 [execsql {SELECT c FROM t1}]} set r2 [execsql {SELECT x FROM t2}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } do_test memdb-5.0 { execsql { DROP TABLE t2; DROP TABLE t3; CREATE TABLE t2(a,b,c); INSERT INTO t2 VALUES(1,2,1); INSERT INTO t2 VALUES(2,3,2); INSERT INTO t2 VALUES(3,4,1); INSERT INTO t2 VALUES(4,5,4); SELECT c FROM t2 ORDER BY b; CREATE TABLE t3(x); INSERT INTO t3 VALUES(1); } } {1 2 1 4} # Six columns of configuration data as follows: # # i The reference number of the test # conf1 The conflict resolution algorithm on the UNIQUE constraint # conf2 The conflict resolution algorithm on the BEGIN statement # cmd An UPDATE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "b" column of t1 assuming no error in $cmd # t2 Content of "x" column of t3 # foreach {i conf1 conf2 cmd t0 t1 t2} { 1 {} {} UPDATE 1 {6 7 8 9} 1 2 REPLACE {} UPDATE 0 {7 6 9} 1 3 IGNORE {} UPDATE 0 {6 7 3 9} 1 4 FAIL {} UPDATE 1 {6 7 3 4} 1 5 ABORT {} UPDATE 1 {1 2 3 4} 1 6 ROLLBACK {} UPDATE 1 {1 2 3 4} 0 7 REPLACE {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 8 IGNORE {} {UPDATE OR REPLACE} 0 {7 6 9} 1 9 FAIL {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 10 ABORT {} {UPDATE OR REPLACE} 0 {7 6 9} 1 11 ROLLBACK {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 12 {} {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 13 {} {} {UPDATE OR REPLACE} 0 {7 6 9} 1 14 {} {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 15 {} {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 16 {} {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 17 {} IGNORE UPDATE 0 {6 7 3 9} 1 18 {} REPLACE UPDATE 0 {7 6 9} 1 19 {} FAIL UPDATE 1 {6 7 3 4} 1 20 {} ABORT UPDATE 1 {1 2 3 4} 1 21 {} ROLLBACK UPDATE 1 {1 2 3 4} 0 22 REPLACE IGNORE UPDATE 0 {6 7 3 9} 1 23 IGNORE REPLACE UPDATE 0 {7 6 9} 1 24 REPLACE FAIL UPDATE 1 {6 7 3 4} 1 25 IGNORE ABORT UPDATE 1 {1 2 3 4} 1 26 REPLACE ROLLBACK UPDATE 1 {1 2 3 4} 0 } { if {$t0} {set t1 {column a is not unique}} do_test memdb-5.$i { if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"} if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"} set r0 [catch {execsql [subst { DROP TABLE t1; CREATE TABLE t1(a,b,c, UNIQUE(a) $conf1); INSERT INTO t1 SELECT * FROM t2; UPDATE t3 SET x=0; BEGIN $conf2; $cmd t3 SET x=1; $cmd t1 SET b=b*2; $cmd t1 SET a=c+5; }]} r1] catch {execsql {COMMIT}} if {!$r0} {set r1 [execsql {SELECT a FROM t1 ORDER BY b}]} set r2 [execsql {SELECT x FROM t3}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } do_test memdb-6.1 { execsql { SELECT * FROM t2; } } {1 2 1 2 3 2 3 4 1 4 5 4} do_test memdb-6.2 { execsql { BEGIN; DROP TABLE t2; SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1; } } {t1 t3 t4} do_test memdb-6.3 { execsql { ROLLBACK; SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1; } } {t1 t2 t3 t4} do_test memdb-6.4 { execsql { SELECT * FROM t2; } } {1 2 1 2 3 2 3 4 1 4 5 4} do_test memdb-6.5 { execsql { SELECT a FROM t2 UNION SELECT b FROM t2 ORDER BY 1; } } {1 2 3 4 5} do_test memdb-6.6 { execsql { CREATE INDEX i2 ON t2(c); SELECT a FROM t2 ORDER BY c; } } {1 3 2 4} do_test memdb-6.6 { execsql { SELECT a FROM t2 ORDER BY c DESC; } } {4 2 3 1} do_test memdb-6.7 { execsql { BEGIN; CREATE TABLE t5(x,y); INSERT INTO t5 VALUES(1,2); SELECT * FROM t5; } } {1 2} do_test memdb-6.8 { execsql { SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1; } } {t1 t2 t3 t4 t5} do_test memdb-6.9 { execsql { ROLLBACK; SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1; } } {t1 t2 t3 t4} do_test memdb-6.10 { execsql { CREATE TABLE t5(x PRIMARY KEY, y UNIQUE); SELECT * FROM t5; } } {} do_test memdb-6.11 { execsql { SELECT * FROM t5 ORDER BY y DESC; } } {} do_test memdb-6.12 { execsql { INSERT INTO t5 VALUES(1,2); INSERT INTO t5 VALUES(3,4); REPLACE INTO t5 VALUES(1,4); SELECT rowid,* FROM t5; } } {3 1 4} do_test memdb-6.13 { execsql { DELETE FROM t5 WHERE x>5; SELECT * FROM t5; } } {1 4} do_test memdb-6.14 { execsql { DELETE FROM t5 WHERE y<3; SELECT * FROM t5; } } {1 4} do_test memdb-6.15 { execsql { DELETE FROM t5 WHERE x>0; SELECT * FROM t5; } } {} do_test memdb-7.1 { execsql { CREATE TABLE t6(x); INSERT INTO t6 VALUES(1); INSERT INTO t6 SELECT x+1 FROM t6; INSERT INTO t6 SELECT x+2 FROM t6; INSERT INTO t6 SELECT x+4 FROM t6; INSERT INTO t6 SELECT x+8 FROM t6; INSERT INTO t6 SELECT x+16 FROM t6; INSERT INTO t6 SELECT x+32 FROM t6; INSERT INTO t6 SELECT x+64 FROM t6; INSERT INTO t6 SELECT x+128 FROM t6; SELECT count(*) FROM (SELECT DISTINCT x FROM t6); } } {256} for {set i 1} {$i<=256} {incr i} { do_test memdb-7.2.$i { execsql "DELETE FROM t6 WHERE x=\ (SELECT x FROM t6 ORDER BY random() LIMIT 1)" execsql {SELECT count(*) FROM t6} } [expr {256-$i}] } finish_test sqlite-2.8.17/test/hook.test0000644000175000001440000000331710232547612015674 0ustar drhusers00000000000000# 2004 Jan 14 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for TCL interface to the # SQLite library. # # The focus of the tests in this file is the following interface: # # sqlite_commit_hook # # $Id: hook.test,v 1.3 2004/01/15 02:44:03 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test hook-1.2 { db commit_hook } {} do_test hook-3.1 { set commit_cnt 0 proc commit_hook {} { incr ::commit_cnt return 0 } db commit_hook ::commit_hook db commit_hook } {::commit_hook} do_test hook-3.2 { set commit_cnt } {0} do_test hook-3.3 { execsql { CREATE TABLE t2(a,b); } set commit_cnt } {1} do_test hook-3.4 { execsql { INSERT INTO t2 VALUES(1,2); INSERT INTO t2 SELECT a+1, b+1 FROM t2; INSERT INTO t2 SELECT a+2, b+2 FROM t2; } set commit_cnt } {4} do_test hook-3.5 { set commit_cnt {} proc commit_hook {} { set ::commit_cnt [execsql {SELECT * FROM t2}] return 0 } execsql { INSERT INTO t2 VALUES(5,6); } set commit_cnt } {1 2 2 3 3 4 4 5 5 6} do_test hook-3.6 { set commit_cnt {} proc commit_hook {} { set ::commit_cnt [execsql {SELECT * FROM t2}] return 1 } catchsql { INSERT INTO t2 VALUES(6,7); } } {1 {constraint failed}} do_test hook-3.7 { set commit_cnt } {1 2 2 3 3 4 4 5 5 6 6 7} do_test hook-3.8 { execsql {SELECT * FROM t2} } {1 2 2 3 3 4 4 5 5 6} finish_test sqlite-2.8.17/test/interrupt.test0000644000175000001440000001066310232547612016772 0ustar drhusers00000000000000# 2004 Feb 8 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is the sqlite_interrupt() API. # # $Id: interrupt.test,v 1.4.2.1 2004/05/10 20:27:42 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Compute a checksum on the entire database. # proc cksum {{db db}} { set txt [$db eval {SELECT name, type, sql FROM sqlite_master}]\n foreach tbl [$db eval {SELECT name FROM sqlite_master WHERE type='table'}] { append txt [$db eval "SELECT * FROM $tbl"]\n } foreach prag {default_synchronous default_cache_size} { append txt $prag-[$db eval "PRAGMA $prag"]\n } set cksum [string length $txt]-[md5 $txt] # puts $cksum-[file size test.db] return $cksum } # This routine attempts to execute the sql in $sql. It triggers an # interrupt a progressively later and later points during the processing # and checks to make sure SQLITE_INTERRUPT is returned. Eventually, # the routine completes successfully. # proc interrupt_test {testid sql result {initcnt 0} {maxcnt 1000000}} { set orig_sum [cksum] set i $initcnt global sqlite_interrupt_count while {$i<$maxcnt} { incr i set sqlite_interrupt_count $i do_test $testid.$i.1 [format { set ::r [catchsql %s] set ::code [db errorcode] expr {$::code==0 || $::code==9} } [list $sql]] 1 if {$::code==9} { do_test $testid.$i.2 { cksum } $orig_sum } elseif {$sqlite_interrupt_count>0} { do_test $testid.$i.99 { set ::r } [list 0 $result] break } } set sqlite_interrupt_count 0 } do_test interrupt-1.1 { execsql { CREATE TABLE t1(a,b); SELECT name FROM sqlite_master; } } {t1} interrupt_test interrupt-1.2 {DROP TABLE t1} {} 1 14 do_test interrupt-1.3 { execsql { SELECT name FROM sqlite_master; } } {} integrity_check interrupt-1.4 do_test interrrupt-2.1 { execsql { BEGIN; CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,randstr(300,400)); INSERT INTO t1 SELECT a+1, randstr(300,400) FROM t1; INSERT INTO t1 SELECT a+2, a || '-' || b FROM t1; INSERT INTO t1 SELECT a+4, a || '-' || b FROM t1; INSERT INTO t1 SELECT a+8, a || '-' || b FROM t1; INSERT INTO t1 SELECT a+16, a || '-' || b FROM t1; INSERT INTO t1 SELECT a+32, a || '-' || b FROM t1; COMMIT; UPDATE t1 SET b=substr(b,-5,5); SELECT count(*) from t1; } } 64 set origsize [file size test.db] set cksum [db eval {SELECT md5sum(a || b) FROM t1}] interrupt_test interrupt-2.2 {VACUUM} {} 100 do_test interrupt-2.3 { execsql { SELECT md5sum(a || b) FROM t1; } } $cksum do_test interrupt-2.4 { expr {$::origsize>[file size test.db]} } 1 integrity_check interrupt-2.5 # Ticket #594. If an interrupt occurs in the middle of a transaction # and that transaction is later rolled back, the internal schema tables do # not reset. # for {set i 1} {$i<50} {incr i 5} { do_test interrupt-3.$i.1 { execsql { BEGIN; CREATE TEMP TABLE t2(x,y); SELECT name FROM sqlite_temp_master; } } {t2} do_test interrupt-3.$i.2 { set ::sqlite_interrupt_count $::i catchsql { INSERT INTO t2 SELECT * FROM t1; } } {1 interrupted} do_test interrupt-3.$i.3 { execsql { SELECT name FROM sqlite_temp_master; } } {t2} do_test interrupt-3.$i.4 { catchsql { ROLLBACK } } {0 {}} do_test interrupt-3.$i.5 { catchsql {SELECT name FROM sqlite_temp_master}; execsql { SELECT name FROM sqlite_temp_master; } } {} } # There are reports of a memory leak if an interrupt occurs during # the beginning of a complex query - before the first callback. We # will try to reproduce it here: # execsql { CREATE TABLE t2(a,b,c); INSERT INTO t2 SELECT round(a/10), randstr(50,80), randstr(50,60) FROM t1; } set sql { SELECT max(min(b,c)), min(max(b,c)), a FROM t2 GROUP BY a ORDER BY a; } set sqlite_interrupt_count 1000000 execsql $sql set max_count [expr {1000000-$sqlite_interrupt_count}] for {set i 1} {$i<$max_count-5} {incr i 1} { do_test interrupt-4.$i.1 { set ::sqlite_interrupt_count $::i catchsql $sql } {1 interrupted} } finish_test sqlite-2.8.17/test/expr.test0000644000175000001440000006352010232547612015714 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing expressions. # # $Id: expr.test,v 1.31 2004/03/03 01:51:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table to work with. # execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)} execsql {INSERT INTO test1 VALUES(1,2,1.1,2.2,'hello','world')} proc test_expr {name settings expr result} { do_test $name [format { execsql {BEGIN; UPDATE test1 SET %s; SELECT %s FROM test1; ROLLBACK;} } $settings $expr] $result } test_expr expr-1.1 {i1=10, i2=20} {i1+i2} 30 test_expr expr-1.2 {i1=10, i2=20} {i1-i2} -10 test_expr expr-1.3 {i1=10, i2=20} {i1*i2} 200 test_expr expr-1.4 {i1=10, i2=20} {i1/i2} 0.5 test_expr expr-1.5 {i1=10, i2=20} {i2/i1} 2 test_expr expr-1.6 {i1=10, i2=20} {i2i1} 1 test_expr expr-1.9 {i1=10, i2=20} {i2>=i1} 1 test_expr expr-1.10 {i1=10, i2=20} {i2!=i1} 1 test_expr expr-1.11 {i1=10, i2=20} {i2=i1} 0 test_expr expr-1.12 {i1=10, i2=20} {i2<>i1} 1 test_expr expr-1.13 {i1=10, i2=20} {i2==i1} 0 test_expr expr-1.14 {i1=20, i2=20} {i2i1} 0 test_expr expr-1.17 {i1=20, i2=20} {i2>=i1} 1 test_expr expr-1.18 {i1=20, i2=20} {i2!=i1} 0 test_expr expr-1.19 {i1=20, i2=20} {i2=i1} 1 test_expr expr-1.20 {i1=20, i2=20} {i2<>i1} 0 test_expr expr-1.21 {i1=20, i2=20} {i2==i1} 1 test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7} test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9} test_expr expr-1.24 {i1=1, i2=2} {min(i1,i2,i1+i2,i1-i2)} {-1} test_expr expr-1.25 {i1=1, i2=2} {max(i1,i2,i1+i2,i1-i2)} {3} test_expr expr-1.26 {i1=1, i2=2} {max(i1,i2,i1+i2,i1-i2)} {3} test_expr expr-1.27 {i1=1, i2=2} {i1==1 AND i2=2} {1} test_expr expr-1.28 {i1=1, i2=2} {i1=2 AND i2=1} {0} test_expr expr-1.29 {i1=1, i2=2} {i1=1 AND i2=1} {0} test_expr expr-1.30 {i1=1, i2=2} {i1=2 AND i2=2} {0} test_expr expr-1.31 {i1=1, i2=2} {i1==1 OR i2=2} {1} test_expr expr-1.32 {i1=1, i2=2} {i1=2 OR i2=1} {0} test_expr expr-1.33 {i1=1, i2=2} {i1=1 OR i2=1} {1} test_expr expr-1.34 {i1=1, i2=2} {i1=2 OR i2=2} {1} test_expr expr-1.35 {i1=1, i2=2} {i1-i2=-1} {1} test_expr expr-1.36 {i1=1, i2=0} {not i1} {0} test_expr expr-1.37 {i1=1, i2=0} {not i2} {1} test_expr expr-1.38 {i1=1} {-i1} {-1} test_expr expr-1.39 {i1=1} {+i1} {1} test_expr expr-1.40 {i1=1, i2=2} {+(i2+i1)} {3} test_expr expr-1.41 {i1=1, i2=2} {-(i2+i1)} {-3} test_expr expr-1.42 {i1=1, i2=2} {i1|i2} {3} test_expr expr-1.42b {i1=1, i2=2} {4|2} {6} test_expr expr-1.43 {i1=1, i2=2} {i1&i2} {0} test_expr expr-1.43b {i1=1, i2=2} {4&5} {4} test_expr expr-1.44 {i1=1} {~i1} {-2} test_expr expr-1.45 {i1=1, i2=3} {i1<>i2} {4} test_expr expr-1.47 {i1=9999999999, i2=8888888888} {i1i2} 1 test_expr expr-1.50 {i1=99999999999, i2=99999999998} {i1i2} 1 test_expr expr-1.53 {i1=099999999999, i2=99999999999} {i1i2} 0 test_expr expr-1.56 {i1=25, i2=11} {i1%i2} 3 test_expr expr-1.58 {i1=NULL, i2=1} {coalesce(i1+i2,99)} 99 test_expr expr-1.59 {i1=1, i2=NULL} {coalesce(i1+i2,99)} 99 test_expr expr-1.60 {i1=NULL, i2=NULL} {coalesce(i1+i2,99)} 99 test_expr expr-1.61 {i1=NULL, i2=1} {coalesce(i1-i2,99)} 99 test_expr expr-1.62 {i1=1, i2=NULL} {coalesce(i1-i2,99)} 99 test_expr expr-1.63 {i1=NULL, i2=NULL} {coalesce(i1-i2,99)} 99 test_expr expr-1.64 {i1=NULL, i2=1} {coalesce(i1*i2,99)} 99 test_expr expr-1.65 {i1=1, i2=NULL} {coalesce(i1*i2,99)} 99 test_expr expr-1.66 {i1=NULL, i2=NULL} {coalesce(i1*i2,99)} 99 test_expr expr-1.67 {i1=NULL, i2=1} {coalesce(i1/i2,99)} 99 test_expr expr-1.68 {i1=1, i2=NULL} {coalesce(i1/i2,99)} 99 test_expr expr-1.69 {i1=NULL, i2=NULL} {coalesce(i1/i2,99)} 99 test_expr expr-1.70 {i1=NULL, i2=1} {coalesce(i1i2,99)} 99 test_expr expr-1.72 {i1=NULL, i2=NULL} {coalesce(i1<=i2,99)} 99 test_expr expr-1.73 {i1=NULL, i2=1} {coalesce(i1>=i2,99)} 99 test_expr expr-1.74 {i1=1, i2=NULL} {coalesce(i1!=i2,99)} 99 test_expr expr-1.75 {i1=NULL, i2=NULL} {coalesce(i1==i2,99)} 99 test_expr expr-1.76 {i1=NULL, i2=NULL} {coalesce(not i1,99)} 99 test_expr expr-1.77 {i1=NULL, i2=NULL} {coalesce(-i1,99)} 99 test_expr expr-1.78 {i1=NULL, i2=NULL} {coalesce(i1 IS NULL AND i2=5,99)} 99 test_expr expr-1.79 {i1=NULL, i2=NULL} {coalesce(i1 IS NULL OR i2=5,99)} 1 test_expr expr-1.80 {i1=NULL, i2=NULL} {coalesce(i1=5 AND i2 IS NULL,99)} 99 test_expr expr-1.81 {i1=NULL, i2=NULL} {coalesce(i1=5 OR i2 IS NULL,99)} 1 test_expr expr-1.82 {i1=NULL, i2=3} {coalesce(min(i1,i2,1),99)} 99 test_expr expr-1.83 {i1=NULL, i2=3} {coalesce(max(i1,i2,1),99)} 99 test_expr expr-1.84 {i1=3, i2=NULL} {coalesce(min(i1,i2,1),99)} 99 test_expr expr-1.85 {i1=3, i2=NULL} {coalesce(max(i1,i2,1),99)} 99 test_expr expr-1.86 {i1=3, i2=8} {5 between i1 and i2} 1 test_expr expr-1.87 {i1=3, i2=8} {5 not between i1 and i2} 0 test_expr expr-1.88 {i1=3, i2=8} {55 between i1 and i2} 0 test_expr expr-1.89 {i1=3, i2=8} {55 not between i1 and i2} 1 test_expr expr-1.90 {i1=3, i2=NULL} {5 between i1 and i2} {{}} test_expr expr-1.91 {i1=3, i2=NULL} {5 not between i1 and i2} {{}} test_expr expr-1.92 {i1=3, i2=NULL} {2 between i1 and i2} 0 test_expr expr-1.93 {i1=3, i2=NULL} {2 not between i1 and i2} 1 test_expr expr-1.94 {i1=NULL, i2=8} {2 between i1 and i2} {{}} test_expr expr-1.95 {i1=NULL, i2=8} {2 not between i1 and i2} {{}} test_expr expr-1.94 {i1=NULL, i2=8} {55 between i1 and i2} 0 test_expr expr-1.95 {i1=NULL, i2=8} {55 not between i1 and i2} 1 test_expr expr-1.96 {i1=NULL, i2=3} {coalesce(i1<>i2,99)} 99 test_expr expr-1.98 {i1=NULL, i2=NULL} {coalesce(i1|i2,99)} 99 test_expr expr-1.99 {i1=32, i2=NULL} {coalesce(i1&i2,99)} 99 test_expr expr-1.100 {i1=1, i2=''} {i1=i2} 0 test_expr expr-1.101 {i1=0, i2=''} {i1=i2} 0 test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57 test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11 test_expr expr-2.3 {r1=1.23, r2=2.34} {r1*r2} 2.8782 test_expr expr-2.4 {r1=1.23, r2=2.34} {r1/r2} 0.525641025641026 test_expr expr-2.5 {r1=1.23, r2=2.34} {r2/r1} 1.90243902439024 test_expr expr-2.6 {r1=1.23, r2=2.34} {r2r1} 1 test_expr expr-2.9 {r1=1.23, r2=2.34} {r2>=r1} 1 test_expr expr-2.10 {r1=1.23, r2=2.34} {r2!=r1} 1 test_expr expr-2.11 {r1=1.23, r2=2.34} {r2=r1} 0 test_expr expr-2.12 {r1=1.23, r2=2.34} {r2<>r1} 1 test_expr expr-2.13 {r1=1.23, r2=2.34} {r2==r1} 0 test_expr expr-2.14 {r1=2.34, r2=2.34} {r2r1} 0 test_expr expr-2.17 {r1=2.34, r2=2.34} {r2>=r1} 1 test_expr expr-2.18 {r1=2.34, r2=2.34} {r2!=r1} 0 test_expr expr-2.19 {r1=2.34, r2=2.34} {r2=r1} 1 test_expr expr-2.20 {r1=2.34, r2=2.34} {r2<>r1} 0 test_expr expr-2.21 {r1=2.34, r2=2.34} {r2==r1} 1 test_expr expr-2.22 {r1=1.23, r2=2.34} {min(r1,r2,r1+r2,r1-r2)} {-1.11} test_expr expr-2.23 {r1=1.23, r2=2.34} {max(r1,r2,r1+r2,r1-r2)} {3.57} test_expr expr-2.24 {r1=25.0, r2=11.0} {r1%r2} 3 test_expr expr-2.25 {r1=1.23, r2=NULL} {coalesce(r1+r2,99.0)} 99.0 test_expr expr-3.1 {t1='abc', t2='xyz'} {t1t2} 0 test_expr expr-3.8 {t1='xyz', t2='abc'} {t1>t2} 1 test_expr expr-3.9 {t1='abc', t2='abc'} {t1>t2} 0 test_expr expr-3.10 {t1='abc', t2='xyz'} {t1>=t2} 0 test_expr expr-3.11 {t1='xyz', t2='abc'} {t1>=t2} 1 test_expr expr-3.12 {t1='abc', t2='abc'} {t1>=t2} 1 test_expr expr-3.13 {t1='abc', t2='xyz'} {t1=t2} 0 test_expr expr-3.14 {t1='xyz', t2='abc'} {t1=t2} 0 test_expr expr-3.15 {t1='abc', t2='abc'} {t1=t2} 1 test_expr expr-3.16 {t1='abc', t2='xyz'} {t1==t2} 0 test_expr expr-3.17 {t1='xyz', t2='abc'} {t1==t2} 0 test_expr expr-3.18 {t1='abc', t2='abc'} {t1==t2} 1 test_expr expr-3.19 {t1='abc', t2='xyz'} {t1<>t2} 1 test_expr expr-3.20 {t1='xyz', t2='abc'} {t1<>t2} 1 test_expr expr-3.21 {t1='abc', t2='abc'} {t1<>t2} 0 test_expr expr-3.22 {t1='abc', t2='xyz'} {t1!=t2} 1 test_expr expr-3.23 {t1='xyz', t2='abc'} {t1!=t2} 1 test_expr expr-3.24 {t1='abc', t2='abc'} {t1!=t2} 0 test_expr expr-3.25 {t1=NULL, t2='hi'} {t1 isnull} 1 test_expr expr-3.25b {t1=NULL, t2='hi'} {t1 is null} 1 test_expr expr-3.26 {t1=NULL, t2='hi'} {t2 isnull} 0 test_expr expr-3.27 {t1=NULL, t2='hi'} {t1 notnull} 0 test_expr expr-3.28 {t1=NULL, t2='hi'} {t2 notnull} 1 test_expr expr-3.28b {t1=NULL, t2='hi'} {t2 is not null} 1 test_expr expr-3.29 {t1='xyz', t2='abc'} {t1||t2} {xyzabc} test_expr expr-3.30 {t1=NULL, t2='abc'} {t1||t2} {{}} test_expr expr-3.31 {t1='xyz', t2=NULL} {t1||t2} {{}} test_expr expr-3.32 {t1='xyz', t2='abc'} {t1||' hi '||t2} {{xyz hi abc}} test_expr epxr-3.33 {t1='abc', t2=NULL} {coalesce(t1t2,99)} 99 test_expr epxr-3.36 {t1='abc', t2=NULL} {coalesce(t2>t1,99)} 99 test_expr epxr-3.37 {t1='abc', t2=NULL} {coalesce(t1<=t2,99)} 99 test_expr epxr-3.38 {t1='abc', t2=NULL} {coalesce(t2<=t1,99)} 99 test_expr epxr-3.39 {t1='abc', t2=NULL} {coalesce(t1>=t2,99)} 99 test_expr epxr-3.40 {t1='abc', t2=NULL} {coalesce(t2>=t1,99)} 99 test_expr epxr-3.41 {t1='abc', t2=NULL} {coalesce(t1==t2,99)} 99 test_expr epxr-3.42 {t1='abc', t2=NULL} {coalesce(t2==t1,99)} 99 test_expr epxr-3.43 {t1='abc', t2=NULL} {coalesce(t1!=t2,99)} 99 test_expr epxr-3.44 {t1='abc', t2=NULL} {coalesce(t2!=t1,99)} 99 test_expr expr-4.1 {t1='abc', t2='Abc'} {t1t2} 1 test_expr expr-4.3 {t1='abc', t2='Bbc'} {t1t2} 1 test_expr expr-4.5 {t1='0', t2='0.0'} {t1==t2} 0 test_expr expr-4.6 {t1='0.000', t2='0.0'} {t1==t2} 0 test_expr expr-4.7 {t1=' 0.000', t2=' 0.0'} {t1==t2} 0 test_expr expr-4.8 {t1='0.0', t2='abc'} {t1r2} 0 test_expr expr-4.11 {r1='abc', r2='Abc'} {r1r2} 1 test_expr expr-4.13 {r1='abc', r2='Bbc'} {r1r2} 1 test_expr expr-4.15 {r1='0', r2='0.0'} {r1==r2} 1 test_expr expr-4.16 {r1='0.000', r2='0.0'} {r1==r2} 1 test_expr expr-4.17 {r1=' 0.000', r2=' 0.0'} {r1==r2} 0 test_expr expr-4.18 {r1='0.0', r2='abc'} {r1r2} 0 test_expr expr-5.1 {t1='abc', t2='xyz'} {t1 LIKE t2} 0 test_expr expr-5.2 {t1='abc', t2='ABC'} {t1 LIKE t2} 1 test_expr expr-5.3 {t1='abc', t2='A_C'} {t1 LIKE t2} 1 test_expr expr-5.4 {t1='abc', t2='abc_'} {t1 LIKE t2} 0 test_expr expr-5.5 {t1='abc', t2='A%C'} {t1 LIKE t2} 1 test_expr expr-5.5b {t1='ac', t2='A%C'} {t1 LIKE t2} 1 test_expr expr-5.6 {t1='abxyzzyc', t2='A%C'} {t1 LIKE t2} 1 test_expr expr-5.7 {t1='abxyzzy', t2='A%C'} {t1 LIKE t2} 0 test_expr expr-5.8 {t1='abxyzzycx', t2='A%C'} {t1 LIKE t2} 0 test_expr expr-5.8b {t1='abxyzzycy', t2='A%CX'} {t1 LIKE t2} 0 test_expr expr-5.9 {t1='abc', t2='A%_C'} {t1 LIKE t2} 1 test_expr expr-5.9b {t1='ac', t2='A%_C'} {t1 LIKE t2} 0 test_expr expr-5.10 {t1='abxyzzyc', t2='A%_C'} {t1 LIKE t2} 1 test_expr expr-5.11 {t1='abc', t2='xyz'} {t1 NOT LIKE t2} 1 test_expr expr-5.12 {t1='abc', t2='ABC'} {t1 NOT LIKE t2} 0 # The following tests only work on versions of TCL that support # Unicode and SQLite configured for UTF-8 support. # if {"\u1234"!="u1234" && [sqlite -encoding]=="UTF-8"} { test_expr expr-5.13 "t1='a\u0080c', t2='A_C'" {t1 LIKE t2} 1 test_expr expr-5.14 "t1='a\u07FFc', t2='A_C'" {t1 LIKE t2} 1 test_expr expr-5.15 "t1='a\u0800c', t2='A_C'" {t1 LIKE t2} 1 test_expr expr-5.16 "t1='a\uFFFFc', t2='A_C'" {t1 LIKE t2} 1 test_expr expr-5.17 "t1='a\u0080', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.18 "t1='a\u07FF', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.19 "t1='a\u0800', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.20 "t1='a\uFFFF', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.21 "t1='ax\uABCD', t2='A_\uABCD'" {t1 LIKE t2} 1 test_expr expr-5.22 "t1='ax\u1234', t2='A%\u1234'" {t1 LIKE t2} 1 test_expr expr-5.23 "t1='ax\uFEDC', t2='A_%'" {t1 LIKE t2} 1 test_expr expr-5.24 "t1='ax\uFEDCy\uFEDC', t2='A%\uFEDC'" {t1 LIKE t2} 1 } # Theses tests are for when SQLite assumes iso8859 characters. # if {[sqlite -encoding]=="iso8859"} { set go 1 if {[info command encoding]!=""} { if {[catch {encoding system iso8859-1} msg]} { puts "skipping tests of LIKE operator: $msg" set go 0 } } if {$go} { test_expr expr-5.50 "t1='a\266c', t2='A_C'" {t1 LIKE t2} 1 test_expr expr-5.51 "t1='a\347', t2='A_'" {t1 LIKE t2} 1 test_expr expr-5.52 "t1='ax\351', t2='A_\351'" {t1 LIKE t2} 1 test_expr expr-5.53 "t1='ax\241', t2='A_%'" {t1 LIKE t2} 1 } } test_expr expr-5.54 {t1='abc', t2=NULL} {t1 LIKE t2} {{}} test_expr expr-5.55 {t1='abc', t2=NULL} {t1 NOT LIKE t2} {{}} test_expr expr-5.56 {t1='abc', t2=NULL} {t2 LIKE t1} {{}} test_expr expr-5.57 {t1='abc', t2=NULL} {t2 NOT LIKE t1} {{}} test_expr expr-6.1 {t1='abc', t2='xyz'} {t1 GLOB t2} 0 test_expr expr-6.2 {t1='abc', t2='ABC'} {t1 GLOB t2} 0 test_expr expr-6.3 {t1='abc', t2='A?C'} {t1 GLOB t2} 0 test_expr expr-6.4 {t1='abc', t2='a?c'} {t1 GLOB t2} 1 test_expr expr-6.5 {t1='abc', t2='abc?'} {t1 GLOB t2} 0 test_expr expr-6.6 {t1='abc', t2='A*C'} {t1 GLOB t2} 0 test_expr expr-6.7 {t1='abc', t2='a*c'} {t1 GLOB t2} 1 test_expr expr-6.8 {t1='abxyzzyc', t2='a*c'} {t1 GLOB t2} 1 test_expr expr-6.9 {t1='abxyzzy', t2='a*c'} {t1 GLOB t2} 0 test_expr expr-6.10 {t1='abxyzzycx', t2='a*c'} {t1 GLOB t2} 0 test_expr expr-6.11 {t1='abc', t2='xyz'} {t1 NOT GLOB t2} 1 test_expr expr-6.12 {t1='abc', t2='abc'} {t1 NOT GLOB t2} 0 test_expr expr-6.13 {t1='abc', t2='a[bx]c'} {t1 GLOB t2} 1 test_expr expr-6.14 {t1='abc', t2='a[cx]c'} {t1 GLOB t2} 0 test_expr expr-6.15 {t1='abc', t2='a[a-d]c'} {t1 GLOB t2} 1 test_expr expr-6.16 {t1='abc', t2='a[^a-d]c'} {t1 GLOB t2} 0 test_expr expr-6.17 {t1='abc', t2='a[A-Dc]c'} {t1 GLOB t2} 0 test_expr expr-6.18 {t1='abc', t2='a[^A-Dc]c'} {t1 GLOB t2} 1 test_expr expr-6.19 {t1='abc', t2='a[]b]c'} {t1 GLOB t2} 1 test_expr expr-6.20 {t1='abc', t2='a[^]b]c'} {t1 GLOB t2} 0 test_expr expr-6.21a {t1='abcdefg', t2='a*[de]g'} {t1 GLOB t2} 0 test_expr expr-6.21b {t1='abcdefg', t2='a*[df]g'} {t1 GLOB t2} 1 test_expr expr-6.21c {t1='abcdefg', t2='a*[d-h]g'} {t1 GLOB t2} 1 test_expr expr-6.21d {t1='abcdefg', t2='a*[b-e]g'} {t1 GLOB t2} 0 test_expr expr-6.22a {t1='abcdefg', t2='a*[^de]g'} {t1 GLOB t2} 1 test_expr expr-6.22b {t1='abcdefg', t2='a*[^def]g'} {t1 GLOB t2} 0 test_expr expr-6.23 {t1='abcdefg', t2='a*?g'} {t1 GLOB t2} 1 test_expr expr-6.24 {t1='ac', t2='a*c'} {t1 GLOB t2} 1 test_expr expr-6.25 {t1='ac', t2='a*?c'} {t1 GLOB t2} 0 # These tests only work on versions of TCL that support Unicode # if {"\u1234"!="u1234" && [sqlite -encoding]=="UTF-8"} { test_expr expr-6.26 "t1='a\u0080c', t2='a?c'" {t1 GLOB t2} 1 test_expr expr-6.27 "t1='a\u07ffc', t2='a?c'" {t1 GLOB t2} 1 test_expr expr-6.28 "t1='a\u0800c', t2='a?c'" {t1 GLOB t2} 1 test_expr expr-6.29 "t1='a\uffffc', t2='a?c'" {t1 GLOB t2} 1 test_expr expr-6.30 "t1='a\u1234', t2='a?'" {t1 GLOB t2} 1 test_expr expr-6.31 "t1='a\u1234', t2='a??'" {t1 GLOB t2} 0 test_expr expr-6.32 "t1='ax\u1234', t2='a?\u1234'" {t1 GLOB t2} 1 test_expr expr-6.33 "t1='ax\u1234', t2='a*\u1234'" {t1 GLOB t2} 1 test_expr expr-6.34 "t1='ax\u1234y\u1234', t2='a*\u1234'" {t1 GLOB t2} 1 test_expr expr-6.35 "t1='a\u1234b', t2='a\[x\u1234y\]b'" {t1 GLOB t2} 1 test_expr expr-6.36 "t1='a\u1234b', t2='a\[\u1233-\u1235\]b'" {t1 GLOB t2} 1 test_expr expr-6.37 "t1='a\u1234b', t2='a\[\u1234-\u124f\]b'" {t1 GLOB t2} 1 test_expr expr-6.38 "t1='a\u1234b', t2='a\[\u1235-\u124f\]b'" {t1 GLOB t2} 0 test_expr expr-6.39 "t1='a\u1234b', t2='a\[a-\u1235\]b'" {t1 GLOB t2} 1 test_expr expr-6.40 "t1='a\u1234b', t2='a\[a-\u1234\]b'" {t1 GLOB t2} 1 test_expr expr-6.41 "t1='a\u1234b', t2='a\[a-\u1233\]b'" {t1 GLOB t2} 0 } test_expr expr-6.51 {t1='ABC', t2='xyz'} {t1 GLOB t2} 0 test_expr expr-6.52 {t1='ABC', t2='abc'} {t1 GLOB t2} 0 test_expr expr-6.53 {t1='ABC', t2='a?c'} {t1 GLOB t2} 0 test_expr expr-6.54 {t1='ABC', t2='A?C'} {t1 GLOB t2} 1 test_expr expr-6.55 {t1='ABC', t2='abc?'} {t1 GLOB t2} 0 test_expr expr-6.56 {t1='ABC', t2='a*c'} {t1 GLOB t2} 0 test_expr expr-6.57 {t1='ABC', t2='A*C'} {t1 GLOB t2} 1 test_expr expr-6.58 {t1='ABxyzzyC', t2='A*C'} {t1 GLOB t2} 1 test_expr expr-6.59 {t1='ABxyzzy', t2='A*C'} {t1 GLOB t2} 0 test_expr expr-6.60 {t1='ABxyzzyCx', t2='A*C'} {t1 GLOB t2} 0 test_expr expr-6.61 {t1='ABC', t2='xyz'} {t1 NOT GLOB t2} 1 test_expr expr-6.62 {t1='ABC', t2='ABC'} {t1 NOT GLOB t2} 0 test_expr expr-6.63 {t1='ABC', t2='A[Bx]C'} {t1 GLOB t2} 1 test_expr expr-6.64 {t1='ABC', t2='A[Cx]C'} {t1 GLOB t2} 0 test_expr expr-6.65 {t1='ABC', t2='A[A-D]C'} {t1 GLOB t2} 1 test_expr expr-6.66 {t1='ABC', t2='A[^A-D]C'} {t1 GLOB t2} 0 test_expr expr-6.67 {t1='ABC', t2='A[a-dC]C'} {t1 GLOB t2} 0 test_expr expr-6.68 {t1='ABC', t2='A[^a-dC]C'} {t1 GLOB t2} 1 test_expr expr-6.69a {t1='ABC', t2='A[]B]C'} {t1 GLOB t2} 1 test_expr expr-6.69b {t1='A]C', t2='A[]B]C'} {t1 GLOB t2} 1 test_expr expr-6.70a {t1='ABC', t2='A[^]B]C'} {t1 GLOB t2} 0 test_expr expr-6.70b {t1='AxC', t2='A[^]B]C'} {t1 GLOB t2} 1 test_expr expr-6.70c {t1='A]C', t2='A[^]B]C'} {t1 GLOB t2} 0 test_expr expr-6.71 {t1='ABCDEFG', t2='A*[DE]G'} {t1 GLOB t2} 0 test_expr expr-6.72 {t1='ABCDEFG', t2='A*[^DE]G'} {t1 GLOB t2} 1 test_expr expr-6.73 {t1='ABCDEFG', t2='A*?G'} {t1 GLOB t2} 1 test_expr expr-6.74 {t1='AC', t2='A*C'} {t1 GLOB t2} 1 test_expr expr-6.75 {t1='AC', t2='A*?C'} {t1 GLOB t2} 0 # Theses tests are for when SQLite assumes iso8859 characters. # if {[sqlite -encoding]=="iso8859"} { set go 1 if {[info command encoding]!=""} { if {[catch {encoding system iso8859-1} msg]} { puts "skipping tests of GLOB operator: $msg" set go 0 } } if {$go} { test_expr expr-6.50 "t1='a\266c', t2='a?c'" {t1 GLOB t2} 1 test_expr expr-6.51 "t1='a\266', t2='a?'" {t1 GLOB t2} 1 test_expr expr-6.52 "t1='a\266', t2='a??'" {t1 GLOB t2} 0 test_expr expr-6.53 "t1='ax\266', t2='a??'" {t1 GLOB t2} 1 test_expr expr-6.54 "t1='ax\266', t2='a?\266'" {t1 GLOB t2} 1 test_expr expr-6.55 "t1='ax\266y\266', t2='a*\266'" {t1 GLOB t2} 1 test_expr expr-6.56 "t1='a\266b', t2='a\[x\266y\]b'" {t1 GLOB t2} 1 test_expr expr-6.57 "t1='a\266b', t2='a\[\260-\270\]b'" {t1 GLOB t2} 1 test_expr expr-6.58 "t1='a\266b', t2='a\[\266-\270\]b'" {t1 GLOB t2} 1 test_expr expr-6.59 "t1='a\266b', t2='a\[\267-\270\]b'" {t1 GLOB t2} 0 test_expr expr-6.60 "t1='a\266b', t2='a\[x-\267\]b'" {t1 GLOB t2} 1 test_expr expr-6.61 "t1='a\266b', t2='a\[x-\266\]b'" {t1 GLOB t2} 1 test_expr expr-6.62 "t1='a\266b', t2='a\[x-\265\]b'" {t1 GLOB t2} 0 } } test_expr expr-6.63 {t1=NULL, t2='a*?c'} {t1 GLOB t2} {{}} test_expr expr-6.64 {t1='ac', t2=NULL} {t1 GLOB t2} {{}} test_expr expr-6.65 {t1=NULL, t2='a*?c'} {t1 NOT GLOB t2} {{}} test_expr expr-6.66 {t1='ac', t2=NULL} {t1 NOT GLOB t2} {{}} test_expr expr-case.1 {i1=1, i2=2} \ {CASE WHEN i1 = i2 THEN 'eq' ELSE 'ne' END} ne test_expr expr-case.2 {i1=2, i2=2} \ {CASE WHEN i1 = i2 THEN 'eq' ELSE 'ne' END} eq test_expr expr-case.3 {i1=NULL, i2=2} \ {CASE WHEN i1 = i2 THEN 'eq' ELSE 'ne' END} ne test_expr expr-case.4 {i1=2, i2=NULL} \ {CASE WHEN i1 = i2 THEN 'eq' ELSE 'ne' END} ne test_expr expr-case.5 {i1=2} \ {CASE i1 WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 'error' END} two test_expr expr-case.6 {i1=1} \ {CASE i1 WHEN 1 THEN 'one' WHEN NULL THEN 'two' ELSE 'error' END} one test_expr expr-case.7 {i1=2} \ {CASE i1 WHEN 1 THEN 'one' WHEN NULL THEN 'two' ELSE 'error' END} error test_expr expr-case.8 {i1=3} \ {CASE i1 WHEN 1 THEN 'one' WHEN NULL THEN 'two' ELSE 'error' END} error test_expr expr-case.9 {i1=3} \ {CASE i1 WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 'error' END} error test_expr expr-case.10 {i1=3} \ {CASE i1 WHEN 1 THEN 'one' WHEN 2 THEN 'two' END} {{}} test_expr expr-case.11 {i1=null} \ {CASE i1 WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 3 END} 3 test_expr expr-case.12 {i1=1} \ {CASE i1 WHEN 1 THEN null WHEN 2 THEN 'two' ELSE 3 END} {{}} test_expr expr-case.13 {i1=7} \ { CASE WHEN i1 < 5 THEN 'low' WHEN i1 < 10 THEN 'medium' WHEN i1 < 15 THEN 'high' ELSE 'error' END} medium # The sqliteExprIfFalse and sqliteExprIfTrue routines are only # executed as part of a WHERE clause. Create a table suitable # for testing these functions. # execsql {DROP TABLE test1} execsql {CREATE TABLE test1(a int, b int);} for {set i 1} {$i<=20} {incr i} { execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])" } execsql "INSERT INTO test1 VALUES(NULL,0)" do_test expr-7.1 { execsql {SELECT * FROM test1 ORDER BY a} } {{} 0 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 11 2048 12 4096 13 8192 14 16384 15 32768 16 65536 17 131072 18 262144 19 524288 20 1048576} proc test_expr2 {name expr result} { do_test $name [format { execsql {SELECT a FROM test1 WHERE %s ORDER BY a} } $expr] $result } test_expr2 expr-7.2 {a<10 AND a>8} {9} test_expr2 expr-7.3 {a<=10 AND a>=8} {8 9 10} test_expr2 expr-7.4 {a>=8 AND a<=10} {8 9 10} test_expr2 expr-7.5 {a>=20 OR a<=1} {1 20} test_expr2 expr-7.6 {b!=4 AND a<=3} {1 3} test_expr2 expr-7.7 {b==8 OR b==16 OR b==32} {3 4 5} test_expr2 expr-7.8 {NOT b<>8 OR b==1024} {3 10} test_expr2 expr-7.9 {b LIKE '10%'} {10 20} test_expr2 expr-7.10 {b LIKE '_4'} {6} test_expr2 expr-7.11 {a GLOB '1?'} {10 11 12 13 14 15 16 17 18 19} test_expr2 expr-7.12 {b GLOB '1*4'} {10 14} test_expr2 expr-7.13 {b GLOB '*1[456]'} {4} test_expr2 expr-7.14 {a ISNULL} {{}} test_expr2 expr-7.15 {a NOTNULL AND a<3} {1 2} test_expr2 expr-7.16 {a AND a<3} {1 2} test_expr2 expr-7.17 {NOT a} {} test_expr2 expr-7.18 {a==11 OR (b>1000 AND b<2000)} {10 11} test_expr2 expr-7.19 {a<=1 OR a>=20} {1 20} test_expr2 expr-7.20 {a<1 OR a>20} {} test_expr2 expr-7.21 {a>19 OR a<1} {20} test_expr2 expr-7.22 {a!=1 OR a=100} \ {2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} test_expr2 expr-7.23 {(a notnull AND a<4) OR a==8} {1 2 3 8} test_expr2 expr-7.24 {a LIKE '2_' OR a==8} {8 20} test_expr2 expr-7.25 {a GLOB '2?' OR a==8} {8 20} test_expr2 expr-7.26 {a isnull OR a=8} {{} 8} test_expr2 expr-7.27 {a notnull OR a=8} \ {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} test_expr2 expr-7.28 {a<0 OR b=0} {{}} test_expr2 expr-7.29 {b=0 OR a<0} {{}} test_expr2 expr-7.30 {a<0 AND b=0} {} test_expr2 expr-7.31 {b=0 AND a<0} {} test_expr2 expr-7.32 {a IS NULL AND (a<0 OR b=0)} {{}} test_expr2 expr-7.33 {a IS NULL AND (b=0 OR a<0)} {{}} test_expr2 expr-7.34 {a IS NULL AND (a<0 AND b=0)} {} test_expr2 expr-7.35 {a IS NULL AND (b=0 AND a<0)} {} test_expr2 expr-7.32 {(a<0 OR b=0) AND a IS NULL} {{}} test_expr2 expr-7.33 {(b=0 OR a<0) AND a IS NULL} {{}} test_expr2 expr-7.34 {(a<0 AND b=0) AND a IS NULL} {} test_expr2 expr-7.35 {(b=0 AND a<0) AND a IS NULL} {} test_expr2 expr-7.36 {a<2 OR (a<0 OR b=0)} {{} 1} test_expr2 expr-7.37 {a<2 OR (b=0 OR a<0)} {{} 1} test_expr2 expr-7.38 {a<2 OR (a<0 AND b=0)} {1} test_expr2 expr-7.39 {a<2 OR (b=0 AND a<0)} {1} test_expr2 expr-7.40 {((a<2 OR a IS NULL) AND b<3) OR b>1e10} {{} 1} test_expr2 expr-7.41 {a BETWEEN -1 AND 1} {1} test_expr2 expr-7.42 {a NOT BETWEEN 2 AND 100} {1} test_expr2 expr-7.43 {(b+1234)||'this is a string that is at least 32 characters long' BETWEEN 1 AND 2} {} test_expr2 expr-7.44 {123||'xabcdefghijklmnopqrstuvwyxz01234567890'||a BETWEEN '123a' AND '123b'} {} test_expr2 expr-7.45 {((123||'xabcdefghijklmnopqrstuvwyxz01234567890'||a) BETWEEN '123a' AND '123b')<0} {} test_expr2 expr-7.46 {((123||'xabcdefghijklmnopqrstuvwyxz01234567890'||a) BETWEEN '123a' AND '123z')>0} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} test_expr2 expr-7.50 {((a between 1 and 2 OR 0) AND 1) OR 0} {1 2} test_expr2 expr-7.51 {((a not between 3 and 100 OR 0) AND 1) OR 0} {1 2} test_expr2 expr-7.52 {((a in (1,2) OR 0) AND 1) OR 0} {1 2} test_expr2 expr-7.53 {((a not in (3,4,5,6,7,8,9,10) OR 0) AND a<11) OR 0} {1 2} test_expr2 expr-7.54 {((a>0 OR 0) AND a<3) OR 0} {1 2} test_expr2 expr-7.55 {((a in (1,2) OR 0) IS NULL AND 1) OR 0} {{}} test_expr2 expr-7.56 {((a not in (3,4,5,6,7,8,9,10) IS NULL OR 0) AND 1) OR 0} \ {{}} test_expr2 expr-7.57 {((a>0 IS NULL OR 0) AND 1) OR 0} {{}} test_expr2 expr-7.58 {(a||'')<='1'} {1} test_expr2 expr-7.59 {LIKE('10%',b)} {10 20} test_expr2 expr-7.60 {LIKE('_4',b)} {6} test_expr2 expr-7.61 {GLOB('1?',a)} {10 11 12 13 14 15 16 17 18 19} test_expr2 expr-7.62 {GLOB('1*4',b)} {10 14} test_expr2 expr-7.63 {GLOB('*1[456]',b)} {4} finish_test sqlite-2.8.17/test/date.test0000644000175000001440000002657410232547612015663 0ustar drhusers00000000000000# 2003 October 31 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing date and time functions. # # $Id: date.test,v 1.7.2.1 2004/07/18 22:25:16 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl proc datetest {tnum expr result} { do_test date-$tnum [subst { execsql "SELECT coalesce($expr,'NULL')" }] [list $result] } datetest 1.1 julianday('2000-01-01') 2451544.5 datetest 1.2 julianday('1970-01-01') 2440587.5 datetest 1.3 julianday('1910-04-20') 2418781.5 datetest 1.4 julianday('1986-02-09') 2446470.5 datetest 1.5 julianday('12:00:00') 2451545 datetest 1.6 {julianday('2000-01-01 12:00:00')} 2451545 datetest 1.7 {julianday('2000-01-01 12:00')} 2451545 datetest 1.8 julianday('bogus') NULL datetest 1.9 julianday('1999-12-31') 2451543.5 datetest 1.10 julianday('1999-12-32') NULL datetest 1.11 julianday('1999-13-01') NULL datetest 1.12 julianday('2003-02-31') 2452701.5 datetest 1.13 julianday('2003-03-03') 2452701.5 datetest 1.14 julianday('+2000-01-01') NULL datetest 1.15 julianday('200-01-01') NULL datetest 1.16 julianday('2000-1-01') NULL datetest 1.17 julianday('2000-01-1') NULL datetest 1.18 {julianday('2000-01-01 12:00:00')} 2451545 datetest 1.19 {julianday('2000-01-01 12:00:00.1')} 2451545.00000116 datetest 1.20 {julianday('2000-01-01 12:00:00.01')} 2451545.00000012 datetest 1.21 {julianday('2000-01-01 12:00:00.001')} 2451545.00000001 datetest 1.22 {julianday('2000-01-01 12:00:00.')} NULL datetest 1.23 julianday(12345.6) 12345.6 datetest 1.24 {julianday('2001-01-01 12:00:00 bogus')} NULL datetest 1.25 {julianday('2001-01-01 bogus')} NULL datetest 2.1 datetime(0,'unixepoch') {1970-01-01 00:00:00} datetest 2.2 datetime(946684800,'unixepoch') {2000-01-01 00:00:00} datetest 2.3 {date('2003-10-22','weekday 0')} 2003-10-26 datetest 2.4 {date('2003-10-22','weekday 1')} 2003-10-27 datetest 2.5 {date('2003-10-22','weekday 2')} 2003-10-28 datetest 2.6 {date('2003-10-22','weekday 3')} 2003-10-22 datetest 2.7 {date('2003-10-22','weekday 4')} 2003-10-23 datetest 2.8 {date('2003-10-22','weekday 5')} 2003-10-24 datetest 2.9 {date('2003-10-22','weekday 6')} 2003-10-25 datetest 2.10 {date('2003-10-22','weekday 7')} NULL datetest 2.11 {date('2003-10-22','weekday 5.5')} NULL datetest 2.12 {datetime('2003-10-22 12:34','weekday 0')} {2003-10-26 12:34:00} datetest 2.13 {datetime('2003-10-22 12:34','start of month')} \ {2003-10-01 00:00:00} datetest 2.14 {datetime('2003-10-22 12:34','start of year')} \ {2003-01-01 00:00:00} datetest 2.15 {datetime('2003-10-22 12:34','start of day')} \ {2003-10-22 00:00:00} datetest 2.16 time('12:34:56.43') 12:34:56 datetest 2.17 {datetime('2003-10-22 12:34','1 day')} {2003-10-23 12:34:00} datetest 2.18 {datetime('2003-10-22 12:34','+1 day')} {2003-10-23 12:34:00} datetest 2.19 {datetime('2003-10-22 12:34','+1.25 day')} {2003-10-23 18:34:00} datetest 2.20 {datetime('2003-10-22 12:34','-1.0 day')} {2003-10-21 12:34:00} datetest 2.21 {datetime('2003-10-22 12:34','1 month')} {2003-11-22 12:34:00} datetest 2.22 {datetime('2003-10-22 12:34','11 month')} {2004-09-22 12:34:00} datetest 2.23 {datetime('2003-10-22 12:34','-13 month')} {2002-09-22 12:34:00} datetest 2.24 {datetime('2003-10-22 12:34','1.5 months')} {2003-12-07 12:34:00} datetest 2.25 {datetime('2003-10-22 12:34','-5 years')} {1998-10-22 12:34:00} datetest 2.26 {datetime('2003-10-22 12:34','+10.5 minutes')} \ {2003-10-22 12:44:30} datetest 2.27 {datetime('2003-10-22 12:34','-1.25 hours')} \ {2003-10-22 11:19:00} datetest 2.28 {datetime('2003-10-22 12:34','11.25 seconds')} \ {2003-10-22 12:34:11} datetest 2.29 {datetime('2003-10-22 12:24','+5 bogus')} NULL datetest 3.1 {strftime('%d','2003-10-31 12:34:56.432')} 31 datetest 3.2 {strftime('%f','2003-10-31 12:34:56.432')} 56.432 datetest 3.3 {strftime('%H','2003-10-31 12:34:56.432')} 12 datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304 datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.024264259 datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10 datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34 datetest 3.8 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696 datetest 3.9 {strftime('%S','2003-10-31 12:34:56.432')} 56 datetest 3.10 {strftime('%w','2003-10-31 12:34:56.432')} 5 datetest 3.11.1 {strftime('%W','2003-10-31 12:34:56.432')} 43 datetest 3.11.2 {strftime('%W','2004-01-01')} 00 datetest 3.11.3 {strftime('%W','2004-01-02')} 00 datetest 3.11.4 {strftime('%W','2004-01-03')} 00 datetest 3.11.5 {strftime('%W','2004-01-04')} 00 datetest 3.11.6 {strftime('%W','2004-01-05')} 01 datetest 3.11.7 {strftime('%W','2004-01-06')} 01 datetest 3.11.8 {strftime('%W','2004-01-07')} 01 datetest 3.11.9 {strftime('%W','2004-01-08')} 01 datetest 3.11.10 {strftime('%W','2004-01-09')} 01 datetest 3.11.11 {strftime('%W','2004-07-18')} 28 datetest 3.11.12 {strftime('%W','2004-12-31')} 52 datetest 3.11.13 {strftime('%W','2007-12-31')} 53 datetest 3.11.14 {strftime('%W','2007-01-01')} 01 datetest 3.12 {strftime('%Y','2003-10-31 12:34:56.432')} 2003 datetest 3.13 {strftime('%%','2003-10-31 12:34:56.432')} % datetest 3.14 {strftime('%_','2003-10-31 12:34:56.432')} NULL datetest 3.15 {strftime('%Y-%m-%d','2003-10-31')} 2003-10-31 proc repeat {n txt} { set x {} while {$n>0} { append x $txt incr n -1 } return $x } datetest 3.16 "strftime('[repeat 200 %Y]','2003-10-31')" [repeat 200 2003] datetest 3.17 "strftime('[repeat 200 abc%m123]','2003-10-31')" \ [repeat 200 abc10123] set now [clock format [clock seconds] -format "%Y-%m-%d" -gmt 1] datetest 4.1 {date('now')} $now datetest 5.1 {datetime('1994-04-16 14:00:00 -05:00')} {1994-04-16 09:00:00} datetest 5.2 {datetime('1994-04-16 14:00:00 +05:15')} {1994-04-16 19:15:00} datetest 5.3 {datetime('1994-04-16 05:00:00 -08:30')} {1994-04-15 20:30:00} datetest 5.4 {datetime('1994-04-16 14:00:00 +11:55')} {1994-04-17 01:55:00} # localtime->utc and utc->localtime conversions. These tests only work # if the localtime is in the US Eastern Time (the time in Charlotte, NC # and in New York.) # if {[clock scan [clock format 0 -format {%b %d, %Y %H:%M:%S}] -gmt 1]==-18000} { datetest 6.1 {datetime('2000-10-29 05:59:00','localtime')}\ {2000-10-29 01:59:00} datetest 6.2 {datetime('2000-10-29 06:00:00','localtime')}\ {2000-10-29 01:00:00} datetest 6.3 {datetime('2000-04-02 06:59:00','localtime')}\ {2000-04-02 01:59:00} datetest 6.4 {datetime('2000-04-02 07:00:00','localtime')}\ {2000-04-02 03:00:00} datetest 6.5 {datetime('2000-10-29 01:59:00','utc')} {2000-10-29 05:59:00} datetest 6.6 {datetime('2000-10-29 02:00:00','utc')} {2000-10-29 07:00:00} datetest 6.7 {datetime('2000-04-02 01:59:00','utc')} {2000-04-02 06:59:00} datetest 6.8 {datetime('2000-04-02 02:00:00','utc')} {2000-04-02 06:00:00} datetest 6.10 {datetime('2000-01-01 12:00:00','localtime')} \ {2000-01-01 07:00:00} datetest 6.11 {datetime('1969-01-01 12:00:00','localtime')} \ {1969-01-01 07:00:00} datetest 6.12 {datetime('2039-01-01 12:00:00','localtime')} \ {2039-01-01 07:00:00} datetest 6.13 {datetime('2000-07-01 12:00:00','localtime')} \ {2000-07-01 08:00:00} datetest 6.14 {datetime('1969-07-01 12:00:00','localtime')} \ {1969-07-01 07:00:00} datetest 6.15 {datetime('2039-07-01 12:00:00','localtime')} \ {2039-07-01 07:00:00} set sqlite_current_time \ [db eval {SELECT strftime('%s','2000-07-01 12:34:56')}] datetest 6.16 {datetime('now','localtime')} {2000-07-01 08:34:56} set sqlite_current_time 0 } # Date-time functions that contain NULL arguments return a NULL # result. # datetest 7.1 {datetime(null)} NULL datetest 7.2 {datetime('now',null)} NULL datetest 7.3 {datetime('now','localtime',null)} NULL datetest 7.4 {time(null)} NULL datetest 7.5 {time('now',null)} NULL datetest 7.6 {time('now','localtime',null)} NULL datetest 7.7 {date(null)} NULL datetest 7.8 {date('now',null)} NULL datetest 7.9 {date('now','localtime',null)} NULL datetest 7.10 {julianday(null)} NULL datetest 7.11 {julianday('now',null)} NULL datetest 7.12 {julianday('now','localtime',null)} NULL datetest 7.13 {strftime(null,'now')} NULL datetest 7.14 {strftime('%s',null)} NULL datetest 7.15 {strftime('%s','now',null)} NULL datetest 7.16 {strftime('%s','now','localtime',null)} NULL # Test modifiers when the date begins as a julian day number - to # make sure the HH:MM:SS is preserved. Ticket #551. # set sqlite_current_time [db eval {SELECT strftime('%s','2003-10-22 12:34:00')}] datetest 8.1 {datetime('now','weekday 0')} {2003-10-26 12:34:00} datetest 8.2 {datetime('now','weekday 1')} {2003-10-27 12:34:00} datetest 8.3 {datetime('now','weekday 2')} {2003-10-28 12:34:00} datetest 8.4 {datetime('now','weekday 3')} {2003-10-22 12:34:00} datetest 8.5 {datetime('now','start of month')} {2003-10-01 00:00:00} datetest 8.6 {datetime('now','start of year')} {2003-01-01 00:00:00} datetest 8.7 {datetime('now','start of day')} {2003-10-22 00:00:00} datetest 8.8 {datetime('now','1 day')} {2003-10-23 12:34:00} datetest 8.9 {datetime('now','+1 day')} {2003-10-23 12:34:00} datetest 8.10 {datetime('now','+1.25 day')} {2003-10-23 18:34:00} datetest 8.11 {datetime('now','-1.0 day')} {2003-10-21 12:34:00} datetest 8.12 {datetime('now','1 month')} {2003-11-22 12:34:00} datetest 8.13 {datetime('now','11 month')} {2004-09-22 12:34:00} datetest 8.14 {datetime('now','-13 month')} {2002-09-22 12:34:00} datetest 8.15 {datetime('now','1.5 months')} {2003-12-07 12:34:00} datetest 8.16 {datetime('now','-5 years')} {1998-10-22 12:34:00} datetest 8.17 {datetime('now','+10.5 minutes')} {2003-10-22 12:44:30} datetest 8.18 {datetime('now','-1.25 hours')} {2003-10-22 11:19:00} datetest 8.19 {datetime('now','11.25 seconds')} {2003-10-22 12:34:11} set sqlite_current_time 0 # Negative years work. Example: '-4713-11-26' is JD 1.5. # datetest 9.1 {julianday('-4713-11-24 12:00:00')} {0} datetest 9.2 {julianday(datetime(5))} {5} datetest 9.3 {julianday(datetime(10))} {10} datetest 9.4 {julianday(datetime(100))} {100} datetest 9.5 {julianday(datetime(1000))} {1000} datetest 9.6 {julianday(datetime(10000))} {10000} datetest 9.7 {julianday(datetime(100000))} {100000} # datetime() with just an HH:MM:SS correctly inserts the date 2000-01-01. # datetest 10.1 {datetime('01:02:03')} {2000-01-01 01:02:03} datetest 10.2 {date('01:02:03')} {2000-01-01} datetest 10.3 {strftime('%Y-%m-%d %H:%M','01:02:03')} {2000-01-01 01:02} # Test the new HH:MM:SS modifier # datetest 11.1 {datetime('2004-02-28 20:00:00', '-01:20:30')} \ {2004-02-28 18:39:30} datetest 11.2 {datetime('2004-02-28 20:00:00', '+12:30:00')} \ {2004-02-29 08:30:00} datetest 11.3 {datetime('2004-02-28 20:00:00', '+12:30')} \ {2004-02-29 08:30:00} datetest 11.4 {datetime('2004-02-28 20:00:00', '12:30')} \ {2004-02-29 08:30:00} datetest 11.5 {datetime('2004-02-28 20:00:00', '-12:00')} \ {2004-02-28 08:00:00} datetest 11.6 {datetime('2004-02-28 20:00:00', '-12:01')} \ {2004-02-28 07:59:00} datetest 11.7 {datetime('2004-02-28 20:00:00', '-11:59')} \ {2004-02-28 08:01:00} datetest 11.8 {datetime('2004-02-28 20:00:00', '11:59')} \ {2004-02-29 07:59:00} datetest 11.9 {datetime('2004-02-28 20:00:00', '12:01')} \ {2004-02-29 08:01:00} finish_test sqlite-2.8.17/test/trigger1.test0000644000175000001440000003116510232547612016462 0ustar drhusers00000000000000# The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file tests creating and dropping triggers, and interaction thereof # with the database COMMIT/ROLLBACK logic. # # 1. CREATE and DROP TRIGGER tests # trig-1.1: Error if table does not exist # trig-1.2: Error if trigger already exists # trig-1.3: Created triggers are deleted if the transaction is rolled back # trig-1.4: DROP TRIGGER removes trigger # trig-1.5: Dropped triggers are restored if the transaction is rolled back # trig-1.6: Error if dropped trigger doesn't exist # trig-1.7: Dropping the table automatically drops all triggers # trig-1.8: A trigger created on a TEMP table is not inserted into sqlite_master # trig-1.9: Ensure that we cannot create a trigger on sqlite_master # trig-1.10: # trig-1.11: # trig-1.12: Ensure that INSTEAD OF triggers cannot be created on tables # trig-1.13: Ensure that AFTER triggers cannot be created on views # trig-1.14: Ensure that BEFORE triggers cannot be created on views # set testdir [file dirname $argv0] source $testdir/tester.tcl do_test trigger1-1.1.2 { catchsql { CREATE TRIGGER trig UPDATE ON no_such_table BEGIN SELECT * from sqlite_master; END; } } {1 {no such table: no_such_table}} do_test trigger1-1.1.2 { catchsql { CREATE TEMP TRIGGER trig UPDATE ON no_such_table BEGIN SELECT * from sqlite_master; END; } } {1 {no such table: no_such_table}} execsql { CREATE TABLE t1(a); } execsql { CREATE TRIGGER tr1 INSERT ON t1 BEGIN INSERT INTO t1 values(1); END; } do_test trigger1-1.2 { catchsql { CREATE TRIGGER tr1 DELETE ON t1 BEGIN SELECT * FROM sqlite_master; END } } {1 {trigger tr1 already exists}} do_test trigger1-1.3 { catchsql { BEGIN; CREATE TRIGGER tr2 INSERT ON t1 BEGIN SELECT * from sqlite_master; END; ROLLBACK; CREATE TRIGGER tr2 INSERT ON t1 BEGIN SELECT * from sqlite_master; END; } } {0 {}} do_test trigger1-1.4 { catchsql { DROP TRIGGER tr1; CREATE TRIGGER tr1 DELETE ON t1 BEGIN SELECT * FROM sqlite_master; END } } {0 {}} do_test trigger1-1.5 { execsql { BEGIN; DROP TRIGGER tr2; ROLLBACK; DROP TRIGGER tr2; } } {} do_test trigger1-1.6 { catchsql { DROP TRIGGER biggles; } } {1 {no such trigger: biggles}} do_test trigger1-1.7 { catchsql { DROP TABLE t1; DROP TRIGGER tr1; } } {1 {no such trigger: tr1}} execsql { CREATE TEMP TABLE temp_table(a); } do_test trigger1-1.8 { execsql { CREATE TRIGGER temp_trig UPDATE ON temp_table BEGIN SELECT * from sqlite_master; END; SELECT count(*) FROM sqlite_master WHERE name = 'temp_trig'; } } {0} do_test trigger1-1.9 { catchsql { CREATE TRIGGER tr1 AFTER UPDATE ON sqlite_master BEGIN SELECT * FROM sqlite_master; END; } } {1 {cannot create trigger on system table}} # Check to make sure that a DELETE statement within the body of # a trigger does not mess up the DELETE that caused the trigger to # run in the first place. # do_test trigger1-1.10 { execsql { create table t1(a,b); insert into t1 values(1,'a'); insert into t1 values(2,'b'); insert into t1 values(3,'c'); insert into t1 values(4,'d'); create trigger r1 after delete on t1 for each row begin delete from t1 WHERE a=old.a+2; end; delete from t1 where a in (1,3); select * from t1; drop table t1; } } {2 b 4 d} do_test trigger1-1.11 { execsql { create table t1(a,b); insert into t1 values(1,'a'); insert into t1 values(2,'b'); insert into t1 values(3,'c'); insert into t1 values(4,'d'); create trigger r1 after update on t1 for each row begin delete from t1 WHERE a=old.a+2; end; update t1 set b='x-' || b where a in (1,3); select * from t1; drop table t1; } } {1 x-a 2 b 4 d} # Ensure that we cannot create INSTEAD OF triggers on tables do_test trigger1-1.12 { catchsql { create table t1(a,b); create trigger t1t instead of update on t1 for each row begin delete from t1 WHERE a=old.a+2; end; } } {1 {cannot create INSTEAD OF trigger on table: t1}} # Ensure that we cannot create BEFORE triggers on views do_test trigger1-1.13 { catchsql { create view v1 as select * from t1; create trigger v1t before update on v1 for each row begin delete from t1 WHERE a=old.a+2; end; } } {1 {cannot create BEFORE trigger on view: v1}} # Ensure that we cannot create AFTER triggers on views do_test trigger1-1.14 { catchsql { drop view v1; create view v1 as select * from t1; create trigger v1t AFTER update on v1 for each row begin delete from t1 WHERE a=old.a+2; end; } } {1 {cannot create AFTER trigger on view: v1}} # Check for memory leaks in the trigger parser # do_test trigger1-2.1 { catchsql { CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN SELECT * FROM; -- Syntax error END; } } {1 {near ";": syntax error}} do_test trigger1-2.2 { catchsql { CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN SELECT * FROM t1; SELECT * FROM; -- Syntax error END; } } {1 {near ";": syntax error}} # Create a trigger that refers to a table that might not exist. # do_test trigger1-3.1 { execsql { CREATE TEMP TABLE t2(x,y); } catchsql { CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN INSERT INTO t2 VALUES(NEW.a,NEW.b); END; } } {0 {}} do_test trigger-3.2 { catchsql { INSERT INTO t1 VALUES(1,2); SELECT * FROM t2; } } {1 {no such table: main.t2}} do_test trigger-3.3 { db close set rc [catch {sqlite db test.db} err] if {$rc} {lappend rc $err} set rc } {0} do_test trigger-3.4 { catchsql { INSERT INTO t1 VALUES(1,2); SELECT * FROM t2; } } {1 {no such table: main.t2}} do_test trigger-3.5 { catchsql { CREATE TEMP TABLE t2(x,y); INSERT INTO t1 VALUES(1,2); SELECT * FROM t2; } } {1 {no such table: main.t2}} do_test trigger-3.6 { catchsql { DROP TRIGGER r1; CREATE TEMP TRIGGER r1 AFTER INSERT ON t1 BEGIN INSERT INTO t2 VALUES(NEW.a,NEW.b); END; INSERT INTO t1 VALUES(1,2); SELECT * FROM t2; } } {0 {1 2}} do_test trigger-3.7 { execsql { DROP TABLE t2; CREATE TABLE t2(x,y); SELECT * FROM t2; } } {} do_test trigger-3.8 { execsql { INSERT INTO t1 VALUES(3,4); SELECT * FROM t1 UNION ALL SELECT * FROM t2; } } {1 2 3 4 3 4} do_test trigger-3.9 { db close sqlite db test.db execsql { INSERT INTO t1 VALUES(5,6); SELECT * FROM t1 UNION ALL SELECT * FROM t2; } } {1 2 3 4 5 6 3 4} do_test trigger-4.1 { execsql { CREATE TEMP TRIGGER r1 BEFORE INSERT ON t1 BEGIN INSERT INTO t2 VALUES(NEW.a,NEW.b); END; INSERT INTO t1 VALUES(7,8); SELECT * FROM t2; } } {3 4 7 8} do_test trigger-4.2 { sqlite db2 test.db execsql { INSERT INTO t1 VALUES(9,10); } db2; db2 close execsql { SELECT * FROM t2; } } {3 4 7 8} do_test trigger-4.3 { execsql { DROP TABLE t1; SELECT * FROM t2; }; } {3 4 7 8} do_test trigger-4.4 { db close sqlite db test.db execsql { SELECT * FROM t2; }; } {3 4 7 8} integrity_check trigger-5.1 # Create a trigger with the same name as a table. Make sure the # trigger works. Then drop the trigger. Make sure the table is # still there. # do_test trigger-6.1 { execsql {SELECT type, name FROM sqlite_master} } {view v1 table t2} do_test trigger-6.2 { execsql { CREATE TRIGGER t2 BEFORE DELETE ON t2 BEGIN SELECT RAISE(ABORT,'deletes are not allows'); END; SELECT type, name FROM sqlite_master; } } {view v1 table t2 trigger t2} do_test trigger-6.3 { catchsql {DELETE FROM t2} } {1 {deletes are not allows}} do_test trigger-6.4 { execsql {SELECT * FROM t2} } {3 4 7 8} do_test trigger-6.5 { db close sqlite db test.db execsql {SELECT type, name FROM sqlite_master} } {view v1 table t2 trigger t2} do_test trigger-6.6 { execsql { DROP TRIGGER t2; SELECT type, name FROM sqlite_master; } } {view v1 table t2} do_test trigger-6.7 { execsql {SELECT * FROM t2} } {3 4 7 8} do_test trigger-6.8 { db close sqlite db test.db execsql {SELECT * FROM t2} } {3 4 7 8} integrity_check trigger-7.1 # Check to make sure the name of a trigger can be quoted so that keywords # can be used as trigger names. Ticket #468 # do_test trigger-8.1 { execsql { CREATE TRIGGER 'trigger' AFTER INSERT ON t2 BEGIN SELECT 1; END; SELECT name FROM sqlite_master WHERE type='trigger'; } } {trigger} do_test trigger-8.2 { execsql { DROP TRIGGER 'trigger'; SELECT name FROM sqlite_master WHERE type='trigger'; } } {} do_test trigger-8.3 { execsql { CREATE TRIGGER "trigger" AFTER INSERT ON t2 BEGIN SELECT 1; END; SELECT name FROM sqlite_master WHERE type='trigger'; } } {trigger} do_test trigger-8.4 { execsql { DROP TRIGGER "trigger"; SELECT name FROM sqlite_master WHERE type='trigger'; } } {} do_test trigger-8.5 { execsql { CREATE TRIGGER [trigger] AFTER INSERT ON t2 BEGIN SELECT 1; END; SELECT name FROM sqlite_master WHERE type='trigger'; } } {trigger} do_test trigger-8.6 { execsql { DROP TRIGGER [trigger]; SELECT name FROM sqlite_master WHERE type='trigger'; } } {} # Make sure REPLACE works inside of triggers. # do_test trigger-9.1 { execsql { CREATE TABLE t3(a,b); CREATE TABLE t4(x UNIQUE, b); CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN REPLACE INTO t4 VALUES(new.a,new.b); END; INSERT INTO t3 VALUES(1,2); SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; } } {1 2 99 99 1 2} do_test trigger-9.2 { execsql { INSERT INTO t3 VALUES(1,3); SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; } } {1 2 1 3 99 99 1 3} execsql { DROP TABLE t2; DROP TABLE t3; DROP TABLE t4; } # Skip the remaining tests if we have a codec. The ATTACH command # will not work right on these tests when there is a codec. # if {[sqlite -has-codec]} { finish_test return } # Ticket #764. At one stage TEMP triggers would fail to re-install when the # schema was reloaded. The following tests ensure that TEMP triggers are # correctly re-installed. # # Also verify that references within trigger programs are resolved at # statement compile time, not trigger installation time. This means, for # example, that you can drop and re-create tables referenced by triggers. do_test trigger-10.0 { file delete -force test2.db file delete -force test2.db-journal sqlite db2 test2.db execsql {CREATE TABLE t3(a, b, c);} db2 db2 close execsql { ATTACH 'test2.db' AS aux; } } {} do_test trigger-10.1 { execsql { CREATE TABLE t1(a, b, c); CREATE temp TABLE t2(a, b, c); CREATE TABLE insert_log(db, a, b, c); } } {} do_test trigger-10.2 { execsql { CREATE TEMP TRIGGER trig1 AFTER INSERT ON t1 BEGIN INSERT INTO insert_log VALUES('main', new.a, new.b, new.c); END; CREATE TEMP TRIGGER trig2 AFTER INSERT ON t2 BEGIN INSERT INTO insert_log VALUES('temp', new.a, new.b, new.c); END; CREATE TEMP TRIGGER trig3 AFTER INSERT ON t3 BEGIN INSERT INTO insert_log VALUES('aux', new.a, new.b, new.c); END; } } {} do_test trigger-10.3 { execsql { INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t2 VALUES(4, 5, 6); INSERT INTO t3 VALUES(7, 8, 9); } } {} do_test trigger-10.4 { execsql { SELECT * FROM insert_log; } } {main 1 2 3 temp 4 5 6 aux 7 8 9} do_test trigger-10.5 { execsql { BEGIN; INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t2 VALUES(4, 5, 6); INSERT INTO t3 VALUES(7, 8, 9); ROLLBACK; } } {} do_test trigger-10.6 { execsql { SELECT * FROM insert_log; } } {main 1 2 3 temp 4 5 6 aux 7 8 9} do_test trigger-10.7 { execsql { DELETE FROM insert_log; INSERT INTO t1 VALUES(11, 12, 13); INSERT INTO t2 VALUES(14, 15, 16); INSERT INTO t3 VALUES(17, 18, 19); } } {} do_test trigger-10.8 { execsql { SELECT * FROM insert_log; } } {main 11 12 13 temp 14 15 16 aux 17 18 19} do_test trigger-10.8 { # Drop and re-create the insert_log table in a different database. Note # that we can change the column names because the trigger programs don't # use them explicitly. execsql { DROP TABLE insert_log; CREATE temp TABLE insert_log(db, d, e, f); } } {} do_test trigger-10.10 { execsql { INSERT INTO t1 VALUES(21, 22, 23); INSERT INTO t2 VALUES(24, 25, 26); INSERT INTO t3 VALUES(27, 28, 29); } } {} do_test trigger-10.11 { execsql { SELECT * FROM insert_log; } } {main 21 22 23 temp 24 25 26 aux 27 28 29} finish_test sqlite-2.8.17/test/trigger2.test0000644000175000001440000004316710232547612016470 0ustar drhusers00000000000000# The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # Regression testing of FOR EACH ROW table triggers # # 1. Trigger execution order tests. # These tests ensure that BEFORE and AFTER triggers are fired at the correct # times relative to each other and the triggering statement. # # trigger2-1.1.*: ON UPDATE trigger execution model. # trigger2-1.2.*: DELETE trigger execution model. # trigger2-1.3.*: INSERT trigger execution model. # # 2. Trigger program execution tests. # These tests ensure that trigger programs execute correctly (ie. that a # trigger program can correctly execute INSERT, UPDATE, DELETE * SELECT # statements, and combinations thereof). # # 3. Selective trigger execution # This tests that conditional triggers (ie. UPDATE OF triggers and triggers # with WHEN clauses) are fired only fired when they are supposed to be. # # trigger2-3.1: UPDATE OF triggers # trigger2-3.2: WHEN clause # # 4. Cascaded trigger execution # Tests that trigger-programs may cause other triggers to fire. Also that a # trigger-program is never executed recursively. # # trigger2-4.1: Trivial cascading trigger # trigger2-4.2: Trivial recursive trigger handling # # 5. Count changes behaviour. # Verify that rows altered by triggers are not included in the return value # of the "count changes" interface. # # 6. ON CONFLICT clause handling # trigger2-6.1[a-f]: INSERT statements # trigger2-6.2[a-f]: UPDATE statements # # 7. Triggers on views fire correctly. # set testdir [file dirname $argv0] source $testdir/tester.tcl # 1. set ii 0 foreach tbl_defn { {CREATE TEMP TABLE tbl (a, b);} {CREATE TABLE tbl (a, b);} {CREATE TABLE tbl (a INTEGER PRIMARY KEY, b);} {CREATE TEMPORARY TABLE tbl (a INTEGER PRIMARY KEY, b);} {CREATE TABLE tbl (a, b PRIMARY KEY);} {CREATE TABLE tbl (a, b); CREATE INDEX tbl_idx ON tbl(b);} {CREATE TEMP TABLE tbl (a, b); CREATE INDEX tbl_idx ON tbl(b);} } { incr ii catchsql { DROP INDEX tbl_idx; } catchsql { DROP TABLE rlog; DROP TABLE clog; DROP TABLE tbl; DROP TABLE other_tbl; } execsql $tbl_defn execsql { INSERT INTO tbl VALUES(1, 2); INSERT INTO tbl VALUES(3, 4); CREATE TABLE rlog (idx, old_a, old_b, db_sum_a, db_sum_b, new_a, new_b); CREATE TABLE clog (idx, old_a, old_b, db_sum_a, db_sum_b, new_a, new_b); CREATE TRIGGER before_update_row BEFORE UPDATE ON tbl FOR EACH ROW BEGIN INSERT INTO rlog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM rlog), old.a, old.b, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), new.a, new.b); END; CREATE TRIGGER after_update_row AFTER UPDATE ON tbl FOR EACH ROW BEGIN INSERT INTO rlog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM rlog), old.a, old.b, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), new.a, new.b); END; CREATE TRIGGER conditional_update_row AFTER UPDATE ON tbl FOR EACH ROW WHEN old.a = 1 BEGIN INSERT INTO clog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM clog), old.a, old.b, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), new.a, new.b); END; } do_test trigger2-1.$ii.1 { execsql { UPDATE tbl SET a = a * 10, b = b * 10; SELECT * FROM rlog ORDER BY idx; SELECT * FROM clog ORDER BY idx; } } [list 1 1 2 4 6 10 20 \ 2 1 2 13 24 10 20 \ 3 3 4 13 24 30 40 \ 4 3 4 40 60 30 40 \ 1 1 2 13 24 10 20 ] execsql { DELETE FROM rlog; DELETE FROM tbl; INSERT INTO tbl VALUES (100, 100); INSERT INTO tbl VALUES (300, 200); CREATE TRIGGER delete_before_row BEFORE DELETE ON tbl FOR EACH ROW BEGIN INSERT INTO rlog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM rlog), old.a, old.b, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), 0, 0); END; CREATE TRIGGER delete_after_row AFTER DELETE ON tbl FOR EACH ROW BEGIN INSERT INTO rlog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM rlog), old.a, old.b, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), 0, 0); END; } do_test trigger2-1.$ii.2 { execsql { DELETE FROM tbl; SELECT * FROM rlog; } } [list 1 100 100 400 300 0 0 \ 2 100 100 300 200 0 0 \ 3 300 200 300 200 0 0 \ 4 300 200 0 0 0 0 ] execsql { DELETE FROM rlog; CREATE TRIGGER insert_before_row BEFORE INSERT ON tbl FOR EACH ROW BEGIN INSERT INTO rlog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM rlog), 0, 0, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), new.a, new.b); END; CREATE TRIGGER insert_after_row AFTER INSERT ON tbl FOR EACH ROW BEGIN INSERT INTO rlog VALUES ( (SELECT coalesce(max(idx),0) + 1 FROM rlog), 0, 0, (SELECT sum(a) FROM tbl), (SELECT sum(b) FROM tbl), new.a, new.b); END; } do_test trigger2-1.$ii.3 { execsql { CREATE TABLE other_tbl(a, b); INSERT INTO other_tbl VALUES(1, 2); INSERT INTO other_tbl VALUES(3, 4); -- INSERT INTO tbl SELECT * FROM other_tbl; INSERT INTO tbl VALUES(5, 6); DROP TABLE other_tbl; SELECT * FROM rlog; } } [list 1 0 0 0 0 5 6 \ 2 0 0 5 6 5 6 ] do_test trigger2-1.$ii.4 { execsql { PRAGMA integrity_check; } } {ok} } catchsql { DROP TABLE rlog; DROP TABLE clog; DROP TABLE tbl; DROP TABLE other_tbl; } # 2. set ii 0 foreach tr_program { {UPDATE tbl SET b = old.b;} {INSERT INTO log VALUES(new.c, 2, 3);} {DELETE FROM log WHERE a = 1;} {INSERT INTO tbl VALUES(500, new.b * 10, 700); UPDATE tbl SET c = old.c; DELETE FROM log;} {INSERT INTO log select * from tbl;} } { foreach test_varset [ list \ { set statement {UPDATE tbl SET c = 10 WHERE a = 1;} set prep {INSERT INTO tbl VALUES(1, 2, 3);} set newC 10 set newB 2 set newA 1 set oldA 1 set oldB 2 set oldC 3 } \ { set statement {DELETE FROM tbl WHERE a = 1;} set prep {INSERT INTO tbl VALUES(1, 2, 3);} set oldA 1 set oldB 2 set oldC 3 } \ { set statement {INSERT INTO tbl VALUES(1, 2, 3);} set newA 1 set newB 2 set newC 3 } ] \ { set statement {} set prep {} set newA {''} set newB {''} set newC {''} set oldA {''} set oldB {''} set oldC {''} incr ii eval $test_varset set statement_type [string range $statement 0 5] set tr_program_fixed $tr_program if {$statement_type == "DELETE"} { regsub -all new\.a $tr_program_fixed {''} tr_program_fixed regsub -all new\.b $tr_program_fixed {''} tr_program_fixed regsub -all new\.c $tr_program_fixed {''} tr_program_fixed } if {$statement_type == "INSERT"} { regsub -all old\.a $tr_program_fixed {''} tr_program_fixed regsub -all old\.b $tr_program_fixed {''} tr_program_fixed regsub -all old\.c $tr_program_fixed {''} tr_program_fixed } set tr_program_cooked $tr_program regsub -all new\.a $tr_program_cooked $newA tr_program_cooked regsub -all new\.b $tr_program_cooked $newB tr_program_cooked regsub -all new\.c $tr_program_cooked $newC tr_program_cooked regsub -all old\.a $tr_program_cooked $oldA tr_program_cooked regsub -all old\.b $tr_program_cooked $oldB tr_program_cooked regsub -all old\.c $tr_program_cooked $oldC tr_program_cooked catchsql { DROP TABLE tbl; DROP TABLE log; } execsql { CREATE TABLE tbl(a PRIMARY KEY, b, c); CREATE TABLE log(a, b, c); } set query {SELECT * FROM tbl; SELECT * FROM log;} set prep "$prep; INSERT INTO log VALUES(1, 2, 3);\ INSERT INTO log VALUES(10, 20, 30);" # Check execution of BEFORE programs: set before_data [ execsql "$prep $tr_program_cooked $statement $query" ] execsql "DELETE FROM tbl; DELETE FROM log; $prep"; execsql "CREATE TRIGGER the_trigger BEFORE [string range $statement 0 6]\ ON tbl BEGIN $tr_program_fixed END;" do_test trigger2-2.$ii-before "execsql {$statement $query}" $before_data execsql "DROP TRIGGER the_trigger;" execsql "DELETE FROM tbl; DELETE FROM log;" # Check execution of AFTER programs set after_data [ execsql "$prep $statement $tr_program_cooked $query" ] execsql "DELETE FROM tbl; DELETE FROM log; $prep"; execsql "CREATE TRIGGER the_trigger AFTER [string range $statement 0 6]\ ON tbl BEGIN $tr_program_fixed END;" do_test trigger2-2.$ii-after "execsql {$statement $query}" $after_data execsql "DROP TRIGGER the_trigger;" do_test trigger2-2.$ii-integrity { execsql { PRAGMA integrity_check; } } {ok} } } catchsql { DROP TABLE tbl; DROP TABLE log; } # 3. # trigger2-3.1: UPDATE OF triggers execsql { CREATE TABLE tbl (a, b, c, d); CREATE TABLE log (a); INSERT INTO log VALUES (0); INSERT INTO tbl VALUES (0, 0, 0, 0); INSERT INTO tbl VALUES (1, 0, 0, 0); CREATE TRIGGER tbl_after_update_cd BEFORE UPDATE OF c, d ON tbl BEGIN UPDATE log SET a = a + 1; END; } do_test trigger2-3.1 { execsql { UPDATE tbl SET b = 1, c = 10; -- 2 UPDATE tbl SET b = 10; -- 0 UPDATE tbl SET d = 4 WHERE a = 0; --1 UPDATE tbl SET a = 4, b = 10; --0 SELECT * FROM log; } } {3} execsql { DROP TABLE tbl; DROP TABLE log; } # trigger2-3.2: WHEN clause set when_triggers [ list \ {t1 BEFORE INSERT ON tbl WHEN new.a > 20} \ {t2 BEFORE INSERT ON tbl WHEN (SELECT count(*) FROM tbl) = 0} ] execsql { CREATE TABLE tbl (a, b, c, d); CREATE TABLE log (a); INSERT INTO log VALUES (0); } foreach trig $when_triggers { execsql "CREATE TRIGGER $trig BEGIN UPDATE log set a = a + 1; END;" } do_test trigger2-3.2 { execsql { INSERT INTO tbl VALUES(0, 0, 0, 0); -- 1 SELECT * FROM log; UPDATE log SET a = 0; INSERT INTO tbl VALUES(0, 0, 0, 0); -- 0 SELECT * FROM log; UPDATE log SET a = 0; INSERT INTO tbl VALUES(200, 0, 0, 0); -- 1 SELECT * FROM log; UPDATE log SET a = 0; } } {1 0 1} execsql { DROP TABLE tbl; DROP TABLE log; } do_test trigger2-3.3 { execsql { PRAGMA integrity_check; } } {ok} # Simple cascaded trigger execsql { CREATE TABLE tblA(a, b); CREATE TABLE tblB(a, b); CREATE TABLE tblC(a, b); CREATE TRIGGER tr1 BEFORE INSERT ON tblA BEGIN INSERT INTO tblB values(new.a, new.b); END; CREATE TRIGGER tr2 BEFORE INSERT ON tblB BEGIN INSERT INTO tblC values(new.a, new.b); END; } do_test trigger2-4.1 { execsql { INSERT INTO tblA values(1, 2); SELECT * FROM tblA; SELECT * FROM tblB; SELECT * FROM tblC; } } {1 2 1 2 1 2} execsql { DROP TABLE tblA; DROP TABLE tblB; DROP TABLE tblC; } # Simple recursive trigger execsql { CREATE TABLE tbl(a, b, c); CREATE TRIGGER tbl_trig BEFORE INSERT ON tbl BEGIN INSERT INTO tbl VALUES (new.a, new.b, new.c); END; } do_test trigger2-4.2 { execsql { INSERT INTO tbl VALUES (1, 2, 3); select * from tbl; } } {1 2 3 1 2 3} execsql { DROP TABLE tbl; } # 5. execsql { CREATE TABLE tbl(a, b, c); CREATE TRIGGER tbl_trig BEFORE INSERT ON tbl BEGIN INSERT INTO tbl VALUES (1, 2, 3); INSERT INTO tbl VALUES (2, 2, 3); UPDATE tbl set b = 10 WHERE a = 1; DELETE FROM tbl WHERE a = 1; DELETE FROM tbl; END; } do_test trigger2-5 { execsql { INSERT INTO tbl VALUES(100, 200, 300); } db changes } {1} execsql { DROP TABLE tbl; } # Handling of ON CONFLICT by INSERT statements inside triggers execsql { CREATE TABLE tbl (a primary key, b, c); CREATE TRIGGER ai_tbl AFTER INSERT ON tbl BEGIN INSERT OR IGNORE INTO tbl values (new.a, 0, 0); END; } do_test trigger2-6.1a { execsql { BEGIN; INSERT INTO tbl values (1, 2, 3); SELECT * from tbl; } } {1 2 3} do_test trigger2-6.1b { catchsql { INSERT OR ABORT INTO tbl values (2, 2, 3); } } {1 {column a is not unique}} do_test trigger2-6.1c { execsql { SELECT * from tbl; } } {1 2 3} do_test trigger2-6.1d { catchsql { INSERT OR FAIL INTO tbl values (2, 2, 3); } } {1 {column a is not unique}} do_test trigger2-6.1e { execsql { SELECT * from tbl; } } {1 2 3 2 2 3} do_test trigger2-6.1f { execsql { INSERT OR REPLACE INTO tbl values (2, 2, 3); SELECT * from tbl; } } {1 2 3 2 0 0} do_test trigger2-6.1g { catchsql { INSERT OR ROLLBACK INTO tbl values (3, 2, 3); } } {1 {column a is not unique}} do_test trigger2-6.1h { execsql { SELECT * from tbl; } } {} execsql {DELETE FROM tbl} # Handling of ON CONFLICT by UPDATE statements inside triggers execsql { INSERT INTO tbl values (4, 2, 3); INSERT INTO tbl values (6, 3, 4); CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN UPDATE OR IGNORE tbl SET a = new.a, c = 10; END; } do_test trigger2-6.2a { execsql { BEGIN; UPDATE tbl SET a = 1 WHERE a = 4; SELECT * from tbl; } } {1 2 10 6 3 4} do_test trigger2-6.2b { catchsql { UPDATE OR ABORT tbl SET a = 4 WHERE a = 1; } } {1 {column a is not unique}} do_test trigger2-6.2c { execsql { SELECT * from tbl; } } {1 2 10 6 3 4} do_test trigger2-6.2d { catchsql { UPDATE OR FAIL tbl SET a = 4 WHERE a = 1; } } {1 {column a is not unique}} do_test trigger2-6.2e { execsql { SELECT * from tbl; } } {4 2 10 6 3 4} do_test trigger2-6.2f.1 { execsql { UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4; SELECT * from tbl; } } {1 3 10} do_test trigger2-6.2f.2 { execsql { INSERT INTO tbl VALUES (2, 3, 4); SELECT * FROM tbl; } } {1 3 10 2 3 4} do_test trigger2-6.2g { catchsql { UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1; } } {1 {column a is not unique}} do_test trigger2-6.2h { execsql { SELECT * from tbl; } } {4 2 3 6 3 4} execsql { DROP TABLE tbl; } # 7. Triggers on views do_test trigger2-7.1 { execsql { CREATE TABLE ab(a, b); CREATE TABLE cd(c, d); INSERT INTO ab VALUES (1, 2); INSERT INTO ab VALUES (0, 0); INSERT INTO cd VALUES (3, 4); CREATE TABLE tlog(ii INTEGER PRIMARY KEY, olda, oldb, oldc, oldd, newa, newb, newc, newd); CREATE VIEW abcd AS SELECT a, b, c, d FROM ab, cd; CREATE TRIGGER before_update INSTEAD OF UPDATE ON abcd BEGIN INSERT INTO tlog VALUES(NULL, old.a, old.b, old.c, old.d, new.a, new.b, new.c, new.d); END; CREATE TRIGGER after_update INSTEAD OF UPDATE ON abcd BEGIN INSERT INTO tlog VALUES(NULL, old.a, old.b, old.c, old.d, new.a, new.b, new.c, new.d); END; CREATE TRIGGER before_delete INSTEAD OF DELETE ON abcd BEGIN INSERT INTO tlog VALUES(NULL, old.a, old.b, old.c, old.d, 0, 0, 0, 0); END; CREATE TRIGGER after_delete INSTEAD OF DELETE ON abcd BEGIN INSERT INTO tlog VALUES(NULL, old.a, old.b, old.c, old.d, 0, 0, 0, 0); END; CREATE TRIGGER before_insert INSTEAD OF INSERT ON abcd BEGIN INSERT INTO tlog VALUES(NULL, 0, 0, 0, 0, new.a, new.b, new.c, new.d); END; CREATE TRIGGER after_insert INSTEAD OF INSERT ON abcd BEGIN INSERT INTO tlog VALUES(NULL, 0, 0, 0, 0, new.a, new.b, new.c, new.d); END; } } {}; do_test trigger2-7.2 { execsql { UPDATE abcd SET a = 100, b = 5*5 WHERE a = 1; DELETE FROM abcd WHERE a = 1; INSERT INTO abcd VALUES(10, 20, 30, 40); SELECT * FROM tlog; } } [ list 1 1 2 3 4 100 25 3 4 \ 2 1 2 3 4 100 25 3 4 \ 3 1 2 3 4 0 0 0 0 \ 4 1 2 3 4 0 0 0 0 \ 5 0 0 0 0 10 20 30 40 \ 6 0 0 0 0 10 20 30 40 ] do_test trigger2-7.3 { execsql { DELETE FROM tlog; INSERT INTO abcd VALUES(10, 20, 30, 40); UPDATE abcd SET a = 100, b = 5*5 WHERE a = 1; DELETE FROM abcd WHERE a = 1; SELECT * FROM tlog; } } [ list \ 1 0 0 0 0 10 20 30 40 \ 2 0 0 0 0 10 20 30 40 \ 3 1 2 3 4 100 25 3 4 \ 4 1 2 3 4 100 25 3 4 \ 5 1 2 3 4 0 0 0 0 \ 6 1 2 3 4 0 0 0 0 \ ] do_test trigger2-7.4 { execsql { DELETE FROM tlog; DELETE FROM abcd WHERE a = 1; INSERT INTO abcd VALUES(10, 20, 30, 40); UPDATE abcd SET a = 100, b = 5*5 WHERE a = 1; SELECT * FROM tlog; } } [ list \ 1 1 2 3 4 0 0 0 0 \ 2 1 2 3 4 0 0 0 0 \ 3 0 0 0 0 10 20 30 40 \ 4 0 0 0 0 10 20 30 40 \ 5 1 2 3 4 100 25 3 4 \ 6 1 2 3 4 100 25 3 4 \ ] do_test trigger2-8.1 { execsql { CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3); CREATE VIEW v1 AS SELECT a+b AS x, b+c AS y, a+c AS z FROM t1; SELECT * FROM v1; } } {3 5 4} do_test trigger2-8.2 { execsql { CREATE TABLE v1log(a,b,c,d,e,f); CREATE TRIGGER r1 INSTEAD OF DELETE ON v1 BEGIN INSERT INTO v1log VALUES(OLD.x,NULL,OLD.y,NULL,OLD.z,NULL); END; DELETE FROM v1 WHERE x=1; SELECT * FROM v1log; } } {} do_test trigger2-8.3 { execsql { DELETE FROM v1 WHERE x=3; SELECT * FROM v1log; } } {3 {} 5 {} 4 {}} do_test trigger2-8.4 { execsql { INSERT INTO t1 VALUES(4,5,6); DELETE FROM v1log; DELETE FROM v1 WHERE y=11; SELECT * FROM v1log; } } {9 {} 11 {} 10 {}} do_test trigger2-8.5 { execsql { CREATE TRIGGER r2 INSTEAD OF INSERT ON v1 BEGIN INSERT INTO v1log VALUES(NULL,NEW.x,NULL,NEW.y,NULL,NEW.z); END; DELETE FROM v1log; INSERT INTO v1 VALUES(1,2,3); SELECT * FROM v1log; } } {{} 1 {} 2 {} 3} do_test trigger2-8.6 { execsql { CREATE TRIGGER r3 INSTEAD OF UPDATE ON v1 BEGIN INSERT INTO v1log VALUES(OLD.x,NEW.x,OLD.y,NEW.y,OLD.z,NEW.z); END; DELETE FROM v1log; UPDATE v1 SET x=x+100, y=y+200, z=z+300; SELECT * FROM v1log; } } {3 103 5 205 4 304 9 109 11 211 10 310} do_test trigger2-9.9 { execsql {PRAGMA integrity_check} } {ok} finish_test sqlite-2.8.17/test/trigger3.test0000644000175000001440000000752310232547612016465 0ustar drhusers00000000000000# The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file tests the RAISE() function. # set testdir [file dirname $argv0] source $testdir/tester.tcl # Test that we can cause ROLLBACK, FAIL and ABORT correctly # catchsql { DROP TABLE tbl; } catchsql { CREATE TABLE tbl (a, b, c) } execsql { CREATE TRIGGER before_tbl_insert BEFORE INSERT ON tbl BEGIN SELECT CASE WHEN (new.a = 4) THEN RAISE(IGNORE) END; END; CREATE TRIGGER after_tbl_insert AFTER INSERT ON tbl BEGIN SELECT CASE WHEN (new.a = 1) THEN RAISE(ABORT, 'Trigger abort') WHEN (new.a = 2) THEN RAISE(FAIL, 'Trigger fail') WHEN (new.a = 3) THEN RAISE(ROLLBACK, 'Trigger rollback') END; END; } # ABORT do_test trigger3-1.1 { catchsql { BEGIN; INSERT INTO tbl VALUES (5, 5, 6); INSERT INTO tbl VALUES (1, 5, 6); } } {1 {Trigger abort}} do_test trigger3-1.2 { execsql { SELECT * FROM tbl; ROLLBACK; } } {5 5 6} do_test trigger3-1.3 { execsql {SELECT * FROM tbl} } {} # FAIL do_test trigger3-2.1 { catchsql { BEGIN; INSERT INTO tbl VALUES (5, 5, 6); INSERT INTO tbl VALUES (2, 5, 6); } } {1 {Trigger fail}} do_test trigger3-2.2 { execsql { SELECT * FROM tbl; ROLLBACK; } } {5 5 6 2 5 6} # ROLLBACK do_test trigger3-3.1 { catchsql { BEGIN; INSERT INTO tbl VALUES (5, 5, 6); INSERT INTO tbl VALUES (3, 5, 6); } } {1 {Trigger rollback}} do_test trigger3-3.2 { execsql { SELECT * FROM tbl; } } {} # IGNORE do_test trigger3-4.1 { catchsql { BEGIN; INSERT INTO tbl VALUES (5, 5, 6); INSERT INTO tbl VALUES (4, 5, 6); } } {0 {}} do_test trigger3-4.2 { execsql { SELECT * FROM tbl; ROLLBACK; } } {5 5 6} # Check that we can also do RAISE(IGNORE) for UPDATE and DELETE execsql {DROP TABLE tbl;} execsql {CREATE TABLE tbl (a, b, c);} execsql {INSERT INTO tbl VALUES(1, 2, 3);} execsql {INSERT INTO tbl VALUES(4, 5, 6);} execsql { CREATE TRIGGER before_tbl_update BEFORE UPDATE ON tbl BEGIN SELECT CASE WHEN (old.a = 1) THEN RAISE(IGNORE) END; END; CREATE TRIGGER before_tbl_delete BEFORE DELETE ON tbl BEGIN SELECT CASE WHEN (old.a = 1) THEN RAISE(IGNORE) END; END; } do_test trigger3-5.1 { execsql { UPDATE tbl SET c = 10; SELECT * FROM tbl; } } {1 2 3 4 5 10} do_test trigger3-5.2 { execsql { DELETE FROM tbl; SELECT * FROM tbl; } } {1 2 3} # Check that RAISE(IGNORE) works correctly for nested triggers: execsql {CREATE TABLE tbl2(a, b, c)} execsql { CREATE TRIGGER after_tbl2_insert AFTER INSERT ON tbl2 BEGIN UPDATE tbl SET c = 10; INSERT INTO tbl2 VALUES (new.a, new.b, new.c); END; } do_test trigger3-6 { execsql { INSERT INTO tbl2 VALUES (1, 2, 3); SELECT * FROM tbl2; SELECT * FROM tbl; } } {1 2 3 1 2 3 1 2 3} # Check that things also work for view-triggers execsql {CREATE VIEW tbl_view AS SELECT * FROM tbl} execsql { CREATE TRIGGER tbl_view_insert INSTEAD OF INSERT ON tbl_view BEGIN SELECT CASE WHEN (new.a = 1) THEN RAISE(ROLLBACK, 'View rollback') WHEN (new.a = 2) THEN RAISE(IGNORE) WHEN (new.a = 3) THEN RAISE(ABORT, 'View abort') END; END; } do_test trigger3-7.1 { catchsql { INSERT INTO tbl_view VALUES(1, 2, 3); } } {1 {View rollback}} do_test trigger3-7.2 { catchsql { INSERT INTO tbl_view VALUES(2, 2, 3); } } {0 {}} do_test trigger3-7.3 { catchsql { INSERT INTO tbl_view VALUES(3, 2, 3); } } {1 {View abort}} integrity_check trigger3-8.1 catchsql { DROP TABLE tbl; } catchsql { DROP TABLE tbl2; } catchsql { DROP VIEW tbl_view; } finish_test sqlite-2.8.17/test/trigger4.test0000644000175000001440000000520710232547612016463 0ustar drhusers00000000000000# The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file tests the triggers of views. # set testdir [file dirname $argv0] source $testdir/tester.tcl do_test trigger4-1.1 { execsql { create table test1(id integer primary key,a); create table test2(id integer,b); create view test as select test1.id as id,a as a,b as b from test1 join test2 on test2.id = test1.id; create trigger I_test instead of insert on test begin insert into test1 (id,a) values (NEW.id,NEW.a); insert into test2 (id,b) values (NEW.id,NEW.b); end; insert into test values(1,2,3); select * from test1; } } {1 2} do_test trigger4-1.2 { execsql { select * from test2; } } {1 3} do_test trigger4-1.3 { db close sqlite db test.db execsql { insert into test values(4,5,6); select * from test1; } } {1 2 4 5} do_test trigger4-1.4 { execsql { select * from test2; } } {1 3 4 6} do_test trigger4-2.1 { execsql { create trigger U_test instead of update on test begin update test1 set a=NEW.a where id=NEW.id; update test2 set b=NEW.b where id=NEW.id; end; update test set a=22 where id=1; select * from test1; } } {1 22 4 5} do_test trigger4-2.2 { execsql { select * from test2; } } {1 3 4 6} do_test trigger4-2.3 { db close sqlite db test.db execsql { update test set b=66 where id=4; select * from test1; } } {1 22 4 5} do_test trigger4-2.4 { execsql { select * from test2; } } {1 3 4 66} do_test trigger4-3.1 { catchsql { drop table test2; insert into test values(7,8,9); } } {1 {no such table: main.test2}} do_test trigger4-3.2 { db close sqlite db test.db catchsql { insert into test values(7,8,9); } } {1 {no such table: main.test2}} do_test trigger4-3.3 { catchsql { update test set a=222 where id=1; } } {1 {no such table: main.test2}} do_test trigger4-3.4 { execsql { select * from test1; } } {1 22 4 5} do_test trigger4-3.5 { execsql { create table test2(id,b); insert into test values(7,8,9); select * from test1; } } {1 22 4 5 7 8} do_test trigger4-3.6 { execsql { select * from test2; } } {7 9} do_test trigger4-3.7 { db close sqlite db test.db execsql { update test set b=99 where id=7; select * from test2; } } {7 99} integrity_check trigger4-4.1 finish_test sqlite-2.8.17/test/lastinsert.test0000644000175000001440000002206310232547612017123 0ustar drhusers00000000000000# The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # Tests to make sure that value returned by last_insert_rowid() (LIRID) # is updated properly, especially inside triggers # # Note 1: insert into table is now the only statement which changes LIRID # Note 2: upon entry into before or instead of triggers, # LIRID is unchanged (rather than -1) # Note 3: LIRID is changed within the context of a trigger, # but is restored once the trigger exits # Note 4: LIRID is not changed by an insert into a view (since everything # is done within instead of trigger context) # set testdir [file dirname $argv0] source $testdir/tester.tcl # ---------------------------------------------------------------------------- # 1.x - basic tests (no triggers) # LIRID changed properly after an insert into a table do_test lastinsert-1.1 { catchsql { create table t1 (k integer primary key); insert into t1 values (1); insert into t1 values (NULL); insert into t1 values (NULL); select last_insert_rowid(); } } {0 3} # LIRID unchanged after an update on a table do_test lastinsert-1.2 { catchsql { update t1 set k=4 where k=2; select last_insert_rowid(); } } {0 3} # LIRID unchanged after a delete from a table do_test lastinsert-1.3 { catchsql { delete from t1 where k=4; select last_insert_rowid(); } } {0 3} # LIRID unchanged after create table/view statements do_test lastinsert-1.4 { catchsql { create table t2 (k integer primary key, val1, val2, val3); create view v as select * from t1; select last_insert_rowid(); } } {0 3} # ---------------------------------------------------------------------------- # 2.x - tests with after insert trigger # LIRID changed properly after an insert into table containing an after trigger do_test lastinsert-2.1 { catchsql { delete from t2; create trigger r1 after insert on t1 for each row begin insert into t2 values (NEW.k*2, last_insert_rowid(), NULL, NULL); update t2 set k=k+10, val2=100+last_insert_rowid(); update t2 set val3=1000+last_insert_rowid(); end; insert into t1 values (13); select last_insert_rowid(); } } {0 13} # LIRID equals NEW.k upon entry into after insert trigger do_test lastinsert-2.2 { catchsql { select val1 from t2; } } {0 13} # LIRID changed properly by insert within context of after insert trigger do_test lastinsert-2.3 { catchsql { select val2 from t2; } } {0 126} # LIRID unchanged by update within context of after insert trigger do_test lastinsert-2.4 { catchsql { select val3 from t2; } } {0 1026} # ---------------------------------------------------------------------------- # 3.x - tests with after update trigger # LIRID not changed after an update onto a table containing an after trigger do_test lastinsert-3.1 { catchsql { delete from t2; drop trigger r1; create trigger r1 after update on t1 for each row begin insert into t2 values (NEW.k*2, last_insert_rowid(), NULL, NULL); update t2 set k=k+10, val2=100+last_insert_rowid(); update t2 set val3=1000+last_insert_rowid(); end; update t1 set k=14 where k=3; select last_insert_rowid(); } } {0 13} # LIRID unchanged upon entry into after update trigger do_test lastinsert-3.2 { catchsql { select val1 from t2; } } {0 13} # LIRID changed properly by insert within context of after update trigger do_test lastinsert-3.3 { catchsql { select val2 from t2; } } {0 128} # LIRID unchanged by update within context of after update trigger do_test lastinsert-3.4 { catchsql { select val3 from t2; } } {0 1028} # ---------------------------------------------------------------------------- # 4.x - tests with instead of insert trigger # LIRID not changed after an insert into view containing an instead of trigger do_test lastinsert-4.1 { catchsql { delete from t2; drop trigger r1; create trigger r1 instead of insert on v for each row begin insert into t2 values (NEW.k*2, last_insert_rowid(), NULL, NULL); update t2 set k=k+10, val2=100+last_insert_rowid(); update t2 set val3=1000+last_insert_rowid(); end; insert into v values (15); select last_insert_rowid(); } } {0 13} # LIRID unchanged upon entry into instead of trigger do_test lastinsert-4.2 { catchsql { select val1 from t2; } } {0 13} # LIRID changed properly by insert within context of instead of trigger do_test lastinsert-4.3 { catchsql { select val2 from t2; } } {0 130} # LIRID unchanged by update within context of instead of trigger do_test lastinsert-4.4 { catchsql { select val3 from t2; } } {0 1030} # ---------------------------------------------------------------------------- # 5.x - tests with before delete trigger # LIRID not changed after a delete on a table containing a before trigger do_test lastinsert-5.1 { catchsql { delete from t2; drop trigger r1; create trigger r1 before delete on t1 for each row begin insert into t2 values (77, last_insert_rowid(), NULL, NULL); update t2 set k=k+10, val2=100+last_insert_rowid(); update t2 set val3=1000+last_insert_rowid(); end; delete from t1 where k=1; select last_insert_rowid(); } } {0 13} # LIRID unchanged upon entry into delete trigger do_test lastinsert-5.2 { catchsql { select val1 from t2; } } {0 13} # LIRID changed properly by insert within context of delete trigger do_test lastinsert-5.3 { catchsql { select val2 from t2; } } {0 177} # LIRID unchanged by update within context of delete trigger do_test lastinsert-5.4 { catchsql { select val3 from t2; } } {0 1077} # ---------------------------------------------------------------------------- # 6.x - tests with instead of update trigger # LIRID not changed after an update on a view containing an instead of trigger do_test lastinsert-6.1 { catchsql { delete from t2; drop trigger r1; create trigger r1 instead of update on v for each row begin insert into t2 values (NEW.k*2, last_insert_rowid(), NULL, NULL); update t2 set k=k+10, val2=100+last_insert_rowid(); update t2 set val3=1000+last_insert_rowid(); end; update v set k=16 where k=14; select last_insert_rowid(); } } {0 13} # LIRID unchanged upon entry into instead of trigger do_test lastinsert-6.2 { catchsql { select val1 from t2; } } {0 13} # LIRID changed properly by insert within context of instead of trigger do_test lastinsert-6.3 { catchsql { select val2 from t2; } } {0 132} # LIRID unchanged by update within context of instead of trigger do_test lastinsert-6.4 { catchsql { select val3 from t2; } } {0 1032} # ---------------------------------------------------------------------------- # 7.x - complex tests with temporary tables and nested instead of triggers do_test lastinsert-7.1 { catchsql { drop table t1; drop table t2; drop trigger r1; create temp table t1 (k integer primary key); create temp table t2 (k integer primary key); create temp view v1 as select * from t1; create temp view v2 as select * from t2; create temp table rid (k integer primary key, rin, rout); insert into rid values (1, NULL, NULL); insert into rid values (2, NULL, NULL); create temp trigger r1 instead of insert on v1 for each row begin update rid set rin=last_insert_rowid() where k=1; insert into t1 values (100+NEW.k); insert into v2 values (100+last_insert_rowid()); update rid set rout=last_insert_rowid() where k=1; end; create temp trigger r2 instead of insert on v2 for each row begin update rid set rin=last_insert_rowid() where k=2; insert into t2 values (1000+NEW.k); update rid set rout=last_insert_rowid() where k=2; end; insert into t1 values (77); select last_insert_rowid(); } } {0 77} do_test lastinsert-7.2 { catchsql { insert into v1 values (5); select last_insert_rowid(); } } {0 77} do_test lastinsert-7.3 { catchsql { select rin from rid where k=1; } } {0 77} do_test lastinsert-7.4 { catchsql { select rout from rid where k=1; } } {0 105} do_test lastinsert-7.5 { catchsql { select rin from rid where k=2; } } {0 105} do_test lastinsert-7.6 { catchsql { select rout from rid where k=2; } } {0 1205} finish_test sqlite-2.8.17/test/btree.test0000644000175000001440000005426510232547612016045 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # $Id: btree.test,v 1.15 2004/02/10 01:54:28 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!="" && $SQLITE_PAGE_SIZE==1024 && $SQLITE_USABLE_SIZE==1024} { # Basic functionality. Open and close a database. # do_test btree-1.1 { file delete -force test1.bt file delete -force test1.bt-journal set rc [catch {btree_open test1.bt} ::b1] } {0} # The second element of the list returned by btree_pager_stats is the # number of pages currently checked out. We'll be checking this value # frequently during this test script, to make sure the btree library # is properly releasing the pages it checks out, and thus avoiding # page leaks. # do_test btree-1.1.1 { lindex [btree_pager_stats $::b1] 1 } {0} do_test btree-1.2 { set rc [catch {btree_open test1.bt} ::b2] } {0} do_test btree-1.3 { set rc [catch {btree_close $::b2} msg] lappend rc $msg } {0 {}} # Do an insert and verify that the database file grows in size. # do_test btree-1.4 { set rc [catch {btree_begin_transaction $::b1} msg] lappend rc $msg } {0 {}} do_test btree-1.4.1 { lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-1.5 { set rc [catch {btree_cursor $::b1 2 1} ::c1] if {$rc} {lappend rc $::c1} set rc } {0} do_test btree-1.6 { set rc [catch {btree_insert $::c1 one 1.00} msg] lappend rc $msg } {0 {}} do_test btree-1.7 { btree_key $::c1 } {one} do_test btree-1.8 { btree_data $::c1 } {1.00} do_test btree-1.9 { set rc [catch {btree_close_cursor $::c1} msg] lappend rc $msg } {0 {}} do_test btree-1.10 { set rc [catch {btree_commit $::b1} msg] lappend rc $msg } {0 {}} do_test btree-1.11 { file size test1.bt } {2048} do_test btree-1.12 { lindex [btree_pager_stats $::b1] 1 } {0} # Reopen the database and attempt to read the record that we wrote. # do_test btree-2.1 { set rc [catch {btree_cursor $::b1 2 1} ::c1] if {$rc} {lappend rc $::c1} set rc } {0} do_test btree-2.2 { btree_move_to $::c1 abc } {1} do_test btree-2.3 { btree_move_to $::c1 xyz } {-1} do_test btree-2.4 { btree_move_to $::c1 one } {0} do_test btree-2.5 { btree_key $::c1 } {one} do_test btree-2.6 { btree_data $::c1 } {1.00} do_test btree-2.7 { lindex [btree_pager_stats $::b1] 1 } {2} # Do some additional inserts # do_test btree-3.1 { btree_begin_transaction $::b1 btree_insert $::c1 two 2.00 btree_key $::c1 } {two} do_test btree-3.1.1 { lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-3.2 { btree_insert $::c1 three 3.00 btree_key $::c1 } {three} do_test btree-3.4 { btree_insert $::c1 four 4.00 btree_key $::c1 } {four} do_test btree-3.5 { btree_insert $::c1 five 5.00 btree_key $::c1 } {five} do_test btree-3.6 { btree_insert $::c1 six 6.00 btree_key $::c1 } {six} #btree_page_dump $::b1 2 do_test btree-3.7 { set rc [btree_move_to $::c1 {}] expr {$rc>0} } {1} do_test btree-3.8 { btree_key $::c1 } {five} do_test btree-3.9 { btree_data $::c1 } {5.00} do_test btree-3.10 { btree_next $::c1 btree_key $::c1 } {four} do_test btree-3.11 { btree_data $::c1 } {4.00} do_test btree-3.12 { btree_next $::c1 btree_key $::c1 } {one} do_test btree-3.13 { btree_data $::c1 } {1.00} do_test btree-3.14 { btree_next $::c1 btree_key $::c1 } {six} do_test btree-3.15 { btree_data $::c1 } {6.00} do_test btree-3.16 { btree_next $::c1 btree_key $::c1 } {three} do_test btree-3.17 { btree_data $::c1 } {3.00} do_test btree-3.18 { btree_next $::c1 btree_key $::c1 } {two} do_test btree-3.19 { btree_data $::c1 } {2.00} do_test btree-3.20 { btree_next $::c1 btree_key $::c1 } {} do_test btree-3.21 { btree_data $::c1 } {} # Commit the changes, reopen and reread the data # do_test btree-3.22 { set rc [catch {btree_close_cursor $::c1} msg] lappend rc $msg } {0 {}} do_test btree-3.22.1 { lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-3.23 { set rc [catch {btree_commit $::b1} msg] lappend rc $msg } {0 {}} do_test btree-3.23.1 { lindex [btree_pager_stats $::b1] 1 } {0} do_test btree-3.24 { file size test1.bt } {2048} do_test btree-3.25 { set rc [catch {btree_cursor $::b1 2 1} ::c1] if {$rc} {lappend rc $::c1} set rc } {0} do_test btree-3.25.1 { lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-3.26 { set rc [btree_move_to $::c1 {}] expr {$rc>0} } {1} do_test btree-3.27 { btree_key $::c1 } {five} do_test btree-3.28 { btree_data $::c1 } {5.00} do_test btree-3.29 { btree_next $::c1 btree_key $::c1 } {four} do_test btree-3.30 { btree_data $::c1 } {4.00} do_test btree-3.31 { btree_next $::c1 btree_key $::c1 } {one} do_test btree-3.32 { btree_data $::c1 } {1.00} do_test btree-3.33 { btree_next $::c1 btree_key $::c1 } {six} do_test btree-3.34 { btree_data $::c1 } {6.00} do_test btree-3.35 { btree_next $::c1 btree_key $::c1 } {three} do_test btree-3.36 { btree_data $::c1 } {3.00} do_test btree-3.37 { btree_next $::c1 btree_key $::c1 } {two} do_test btree-3.38 { btree_data $::c1 } {2.00} do_test btree-3.39 { btree_next $::c1 btree_key $::c1 } {} do_test btree-3.40 { btree_data $::c1 } {} do_test btree-3.41 { lindex [btree_pager_stats $::b1] 1 } {2} # Now try a delete # do_test btree-4.1 { btree_begin_transaction $::b1 btree_move_to $::c1 one btree_key $::c1 } {one} do_test btree-4.1.1 { lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-4.2 { btree_delete $::c1 } {} do_test btree-4.3 { btree_key $::c1 } {six} do_test btree-4.4 { btree_next $::c1 btree_key $::c1 } {six} do_test btree-4.5 { btree_next $::c1 btree_key $::c1 } {three} do_test btree-4.4 { btree_move_to $::c1 {} set r {} while 1 { set key [btree_key $::c1] if {$key==""} break lappend r $key lappend r [btree_data $::c1] btree_next $::c1 } set r } {five 5.00 four 4.00 six 6.00 three 3.00 two 2.00} # Commit and make sure the delete is still there. # do_test btree-4.5 { btree_commit $::b1 btree_move_to $::c1 {} set r {} while 1 { set key [btree_key $::c1] if {$key==""} break lappend r $key lappend r [btree_data $::c1] btree_next $::c1 } set r } {five 5.00 four 4.00 six 6.00 three 3.00 two 2.00} # Completely close the database and reopen it. Then check # the data again. # do_test btree-4.6 { lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-4.7 { btree_close_cursor $::c1 lindex [btree_pager_stats $::b1] 1 } {0} do_test btree-4.8 { btree_close $::b1 set ::b1 [btree_open test1.bt] set ::c1 [btree_cursor $::b1 2 1] lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-4.9 { set r {} btree_first $::c1 while 1 { set key [btree_key $::c1] if {$key==""} break lappend r $key lappend r [btree_data $::c1] btree_next $::c1 } set r } {five 5.00 four 4.00 six 6.00 three 3.00 two 2.00} # Try to read and write meta data # do_test btree-5.1 { btree_get_meta $::b1 } {0 0 0 0 0 0 0 0 0 0} do_test btree-5.2 { set rc [catch {btree_update_meta $::b1 1 2 3 4 5 6 7 8 9 10} msg] lappend rc $msg } {1 SQLITE_ERROR} do_test btree-5.3 { btree_begin_transaction $::b1 set rc [catch {btree_update_meta $::b1 1 2 3 4 5 6 7 8 9 10} msg] lappend rc $msg } {0 {}} do_test btree-5.4 { btree_get_meta $::b1 } {0 2 3 4 5 6 7 8 9 10} do_test btree-5.5 { btree_close_cursor $::c1 btree_rollback $::b1 btree_get_meta $::b1 } {0 0 0 0 0 0 0 0 0 0} do_test btree-5.6 { btree_begin_transaction $::b1 btree_update_meta $::b1 999 10 20 30 40 50 60 70 80 90 btree_commit $::b1 btree_get_meta $::b1 } {0 10 20 30 40 50 60 70 80 90} proc select_all {cursor} { set r {} btree_move_to $cursor {} while 1 { set key [btree_key $cursor] if {$key==""} break lappend r $key lappend r [btree_data $cursor] btree_next $cursor } return $r } proc select_keys {cursor} { set r {} btree_move_to $cursor {} while 1 { set key [btree_key $cursor] if {$key==""} break lappend r $key btree_next $cursor } return $r } # Try to create a new table in the database file # do_test btree-6.1 { set rc [catch {btree_create_table $::b1} msg] lappend rc $msg } {1 SQLITE_ERROR} do_test btree-6.2 { btree_begin_transaction $::b1 set ::t2 [btree_create_table $::b1] } {3} do_test btree-6.2.1 { lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-6.2.2 { set ::c2 [btree_cursor $::b1 $::t2 1] lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-6.2.3 { btree_insert $::c2 ten 10 btree_key $::c2 } {ten} do_test btree-6.3 { btree_commit $::b1 set ::c1 [btree_cursor $::b1 2 1] lindex [btree_pager_stats $::b1] 1 } {3} do_test btree-6.3.1 { select_all $::c1 } {five 5.00 four 4.00 six 6.00 three 3.00 two 2.00} #btree_page_dump $::b1 3 do_test btree-6.4 { select_all $::c2 } {ten 10} # Drop the new table, then create it again anew. # do_test btree-6.5 { btree_begin_transaction $::b1 } {} do_test btree-6.6 { btree_close_cursor $::c2 } {} do_test btree-6.6.1 { lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-6.7 { btree_drop_table $::b1 $::t2 } {} do_test btree-6.7.1 { lindex [btree_get_meta $::b1] 0 } {1} do_test btree-6.8 { set ::t2 [btree_create_table $::b1] } {3} do_test btree-6.8.1 { lindex [btree_get_meta $::b1] 0 } {0} do_test btree-6.9 { set ::c2 [btree_cursor $::b1 $::t2 1] lindex [btree_pager_stats $::b1] 1 } {3} do_test btree-6.9.1 { btree_move_to $::c2 {} btree_key $::c2 } {} # If we drop table 2 it just clears the table. Table 2 always exists. # do_test btree-6.10 { btree_close_cursor $::c1 btree_drop_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] btree_move_to $::c1 {} btree_key $::c1 } {} do_test btree-6.11 { btree_commit $::b1 select_all $::c1 } {} do_test btree-6.12 { select_all $::c2 } {} do_test btree-6.13 { btree_close_cursor $::c2 lindex [btree_pager_stats $::b1] 1 } {2} # Check to see that pages defragment properly. To do this test we will # # 1. Fill the first page table 2 with data. # 2. Delete every other entry of table 2. # 3. Insert a single entry that requires more contiguous # space than is available. # do_test btree-7.1 { btree_begin_transaction $::b1 } {} catch {unset key} catch {unset data} do_test btree-7.2 { for {set i 0} {$i<36} {incr i} { set key [format %03d $i] set data "*** $key ***" btree_insert $::c1 $key $data } lrange [btree_cursor_dump $::c1] 4 5 } {8 1} do_test btree-7.3 { btree_move_to $::c1 000 while {[btree_key $::c1]!=""} { btree_delete $::c1 btree_next $::c1 btree_next $::c1 } lrange [btree_cursor_dump $::c1] 4 5 } {512 19} #btree_page_dump $::b1 2 do_test btree-7.4 { btree_insert $::c1 018 {*** 018 ***+++} btree_key $::c1 } {018} do_test btree-7.5 { lrange [btree_cursor_dump $::c1] 4 5 } {480 1} #btree_page_dump $::b1 2 # Delete an entry to make a hole of a known size, then immediately recreate # that entry. This tests the path into allocateSpace where the hole exactly # matches the size of the desired space. # do_test btree-7.6 { btree_move_to $::c1 007 btree_delete $::c1 btree_move_to $::c1 011 btree_delete $::c1 } {} do_test btree-7.7 { lindex [btree_cursor_dump $::c1] 5 } {3} #btree_page_dump $::b1 2 do_test btree-7.8 { btree_insert $::c1 007 {*** 007 ***} lindex [btree_cursor_dump $::c1] 5 } {2} #btree_page_dump $::b1 2 # Make sure the freeSpace() routine properly coaleses adjacent memory blocks # do_test btree-7.9 { btree_move_to $::c1 013 btree_delete $::c1 lrange [btree_cursor_dump $::c1] 4 5 } {536 2} do_test btree-7.10 { btree_move_to $::c1 009 btree_delete $::c1 lrange [btree_cursor_dump $::c1] 4 5 } {564 2} do_test btree-7.11 { btree_move_to $::c1 018 btree_delete $::c1 lrange [btree_cursor_dump $::c1] 4 5 } {596 2} do_test btree-7.13 { btree_move_to $::c1 033 btree_delete $::c1 lrange [btree_cursor_dump $::c1] 4 5 } {624 3} do_test btree-7.14 { btree_move_to $::c1 035 btree_delete $::c1 lrange [btree_cursor_dump $::c1] 4 5 } {652 2} #btree_page_dump $::b1 2 do_test btree-7.15 { lindex [btree_pager_stats $::b1] 1 } {2} # Check to see that data on overflow pages work correctly. # do_test btree-8.1 { set data "*** This is a very long key " while {[string length $data]<256} {append data $data} set ::data $data btree_insert $::c1 020 $data } {} #btree_page_dump $::b1 2 do_test btree-8.1.1 { lindex [btree_pager_stats $::b1] 1 } {2} #btree_pager_ref_dump $::b1 do_test btree-8.2 { string length [btree_data $::c1] } [string length $::data] do_test btree-8.3 { btree_data $::c1 } $::data do_test btree-8.4 { btree_delete $::c1 } {} do_test btree-8.4.1 { lindex [btree_get_meta $::b1] 0 } [expr {int(([string length $::data]-238+1019)/1020)}] do_test btree-8.5 { set data "*** This is an even longer key" while {[string length $data]<2000} {append data $data} set ::data $data btree_insert $::c1 020 $data } {} do_test btree-8.6 { string length [btree_data $::c1] } [string length $::data] do_test btree-8.7 { btree_data $::c1 } $::data do_test btree-8.8 { btree_commit $::b1 btree_data $::c1 } $::data do_test btree-8.9 { btree_close_cursor $::c1 btree_close $::b1 set ::b1 [btree_open test1.bt] set ::c1 [btree_cursor $::b1 2 1] btree_move_to $::c1 020 btree_data $::c1 } $::data do_test btree-8.10 { btree_begin_transaction $::b1 btree_delete $::c1 } {} do_test btree-8.11 { lindex [btree_get_meta $::b1] 0 } [expr {int(([string length $::data]-238+1019)/1020)}] # Now check out keys on overflow pages. # do_test btree-8.12 { set ::keyprefix "This is a long prefix to a key " while {[string length $::keyprefix]<256} {append ::keyprefix $::keyprefix} btree_close_cursor $::c1 btree_drop_table $::b1 2 lindex [btree_get_meta $::b1] 0 } {4} do_test btree-8.12.1 { set ::c1 [btree_cursor $::b1 2 1] btree_insert $::c1 ${::keyprefix}1 1 btree_data $::c1 } {1} do_test btree-8.13 { btree_key $::c1 } ${keyprefix}1 do_test btree-8.14 { btree_insert $::c1 ${::keyprefix}2 2 btree_insert $::c1 ${::keyprefix}3 3 btree_key $::c1 } ${keyprefix}3 do_test btree-8.15 { btree_move_to $::c1 ${::keyprefix}2 btree_data $::c1 } {2} do_test btree-8.16 { btree_move_to $::c1 ${::keyprefix}1 btree_data $::c1 } {1} do_test btree-8.17 { btree_move_to $::c1 ${::keyprefix}3 btree_data $::c1 } {3} do_test btree-8.18 { lindex [btree_get_meta $::b1] 0 } {1} do_test btree-8.19 { btree_move_to $::c1 ${::keyprefix}2 btree_key $::c1 } ${::keyprefix}2 #btree_page_dump $::b1 2 do_test btree-8.20 { btree_delete $::c1 btree_next $::c1 btree_key $::c1 } ${::keyprefix}3 #btree_page_dump $::b1 2 do_test btree-8.21 { lindex [btree_get_meta $::b1] 0 } {2} do_test btree-8.22 { lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-8.23 { btree_close_cursor $::c1 btree_drop_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] lindex [btree_get_meta $::b1] 0 } {4} do_test btree-8.24 { lindex [btree_pager_stats $::b1] 1 } {2} #btree_pager_ref_dump $::b1 # Check page splitting logic # do_test btree-9.1 { for {set i 1} {$i<=19} {incr i} { set key [format %03d $i] set data "*** $key *** $key *** $key *** $key ***" btree_insert $::c1 $key $data } } {} #btree_tree_dump $::b1 2 #btree_pager_ref_dump $::b1 #set pager_refinfo_enable 1 do_test btree-9.2 { btree_insert $::c1 020 {*** 020 *** 020 *** 020 *** 020 ***} select_keys $::c1 } {001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020} #btree_page_dump $::b1 5 #btree_page_dump $::b1 2 #btree_page_dump $::b1 7 #btree_pager_ref_dump $::b1 #set pager_refinfo_enable 0 # The previous "select_keys" command left the cursor pointing at the root # page. So there should only be two pages checked out. 2 (the root) and # page 1. do_test btree-9.2.1 { lindex [btree_pager_stats $::b1] 1 } {2} for {set i 1} {$i<=20} {incr i} { do_test btree-9.3.$i.1 [subst { btree_move_to $::c1 [format %03d $i] btree_key $::c1 }] [format %03d $i] do_test btree-9.3.$i.2 [subst { btree_move_to $::c1 [format %03d $i] string range \[btree_data $::c1\] 0 10 }] "*** [format %03d $i] ***" } do_test btree-9.4.1 { lindex [btree_pager_stats $::b1] 1 } {3} # Check the page joining logic. # #btree_page_dump $::b1 2 #btree_pager_ref_dump $::b1 do_test btree-9.4.2 { btree_move_to $::c1 005 btree_delete $::c1 } {} #btree_page_dump $::b1 2 for {set i 1} {$i<=19} {incr i} { if {$i==5} continue do_test btree-9.5.$i.1 [subst { btree_move_to $::c1 [format %03d $i] btree_key $::c1 }] [format %03d $i] do_test btree-9.5.$i.2 [subst { btree_move_to $::c1 [format %03d $i] string range \[btree_data $::c1\] 0 10 }] "*** [format %03d $i] ***" } #btree_pager_ref_dump $::b1 do_test btree-9.6 { btree_close_cursor $::c1 lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-9.7 { btree_rollback $::b1 lindex [btree_pager_stats $::b1] 1 } {0} # Create a tree of depth two. That is, there is a single divider entry # on the root pages and two leaf pages. Then delete the divider entry # see what happens. # do_test btree-10.1 { btree_begin_transaction $::b1 btree_drop_table $::b1 2 lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-10.2 { set ::c1 [btree_cursor $::b1 2 1] lindex [btree_pager_stats $::b1] 1 } {2} do_test btree-10.3 { for {set i 1} {$i<=20} {incr i} { set key [format %03d $i] set data "*** $key *** $key *** $key *** $key ***" btree_insert $::c1 $key $data } select_keys $::c1 } {001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020} #btree_page_dump $::b1 7 #btree_page_dump $::b1 2 #btree_page_dump $::b1 6 do_test btree-10.4 { btree_move_to $::c1 011 btree_delete $::c1 select_keys $::c1 } {001 002 003 004 005 006 007 008 009 010 012 013 014 015 016 017 018 019 020} #btree_tree_dump $::b1 2 #btree_pager_ref_dump $::b1 for {set i 1} {$i<=20} {incr i} { do_test btree-10.5.$i { btree_move_to $::c1 [format %03d $i] lindex [btree_pager_stats $::b1] 1 } {2} #btree_pager_ref_dump $::b1 #btree_tree_dump $::b1 2 } # Create a tree with lots more pages # catch {unset ::data} catch {unset ::key} for {set i 21} {$i<=1000} {incr i} { do_test btree-11.1.$i.1 { set key [format %03d $i] set ::data "*** $key *** $key *** $key *** $key ***" btree_insert $::c1 $key $data btree_key $::c1 } [format %03d $i] do_test btree-11.1.$i.2 { btree_data $::c1 } $::data set ::key [format %03d [expr {$i/2}]] if {$::key=="011"} {set ::key 010} do_test btree-11.1.$i.3 { btree_move_to $::c1 $::key btree_key $::c1 } $::key } catch {unset ::data} catch {unset ::key} # Make sure our reference count is still correct. # do_test btree-11.2 { btree_close_cursor $::c1 lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-11.3 { set ::c1 [btree_cursor $::b1 2 1] lindex [btree_pager_stats $::b1] 1 } {2} #btree_page_dump $::b1 2 # Delete the dividers on the root page # do_test btree-11.4 { btree_move_to $::c1 257 btree_delete $::c1 btree_next $::c1 btree_key $::c1 } {258} do_test btree-11.4.1 { btree_move_to $::c1 256 btree_key $::c1 } {256} do_test btree-11.4.2 { btree_move_to $::c1 258 btree_key $::c1 } {258} do_test btree-11.4.3 { btree_move_to $::c1 259 btree_key $::c1 } {259} do_test btree-11.4.4 { btree_move_to $::c1 257 set n [btree_key $::c1] expr {$n==256||$n==258} } {1} do_test btree-11.5 { btree_move_to $::c1 513 btree_delete $::c1 btree_next $::c1 btree_key $::c1 } {514} do_test btree-11.5.1 { btree_move_to $::c1 512 btree_key $::c1 } {512} do_test btree-11.5.2 { btree_move_to $::c1 514 btree_key $::c1 } {514} do_test btree-11.5.3 { btree_move_to $::c1 515 btree_key $::c1 } {515} do_test btree-11.5.4 { btree_move_to $::c1 513 set n [btree_key $::c1] expr {$n==512||$n==514} } {1} do_test btree-11.6 { btree_move_to $::c1 769 btree_delete $::c1 btree_next $::c1 btree_key $::c1 } {770} do_test btree-11.6.1 { btree_move_to $::c1 768 btree_key $::c1 } {768} do_test btree-11.6.2 { btree_move_to $::c1 771 btree_key $::c1 } {771} do_test btree-11.6.3 { btree_move_to $::c1 770 btree_key $::c1 } {770} do_test btree-11.6.4 { btree_move_to $::c1 769 set n [btree_key $::c1] expr {$n==768||$n==770} } {1} #btree_page_dump $::b1 2 #btree_page_dump $::b1 25 # Change the data on an intermediate node such that the node becomes overfull # and has to split. We happen to know that intermediate nodes exist on # 337, 401 and 465 by the btree_page_dumps above # catch {unset ::data} set ::data {This is going to be a very long data segment} append ::data $::data append ::data $::data do_test btree-12.1 { btree_insert $::c1 337 $::data btree_data $::c1 } $::data do_test btree-12.2 { btree_insert $::c1 401 $::data btree_data $::c1 } $::data do_test btree-12.3 { btree_insert $::c1 465 $::data btree_data $::c1 } $::data do_test btree-12.4 { btree_move_to $::c1 337 btree_key $::c1 } {337} do_test btree-12.5 { btree_data $::c1 } $::data do_test btree-12.6 { btree_next $::c1 btree_key $::c1 } {338} do_test btree-12.7 { btree_move_to $::c1 464 btree_key $::c1 } {464} do_test btree-12.8 { btree_next $::c1 btree_data $::c1 } $::data do_test btree-12.9 { btree_next $::c1 btree_key $::c1 } {466} do_test btree-12.10 { btree_move_to $::c1 400 btree_key $::c1 } {400} do_test btree-12.11 { btree_next $::c1 btree_data $::c1 } $::data do_test btree-12.12 { btree_next $::c1 btree_key $::c1 } {402} do_test btree-13.1 { btree_integrity_check $::b1 2 3 } {} # To Do: # # 1. Do some deletes from the 3-layer tree # 2. Commit and reopen the database # 3. Read every 15th entry and make sure it works # 4. Implement btree_sanity and put it throughout this script # do_test btree-15.98 { btree_close_cursor $::c1 lindex [btree_pager_stats $::b1] 1 } {1} do_test btree-15.99 { btree_rollback $::b1 lindex [btree_pager_stats $::b1] 1 } {0} btree_pager_ref_dump $::b1 do_test btree-99.1 { btree_close $::b1 } {} catch {unset data} catch {unset key} } ;# end if( not mem: and has pager_open command ); finish_test sqlite-2.8.17/test/misc1.test0000644000175000001440000003502410232547612015750 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # # $Id: misc1.test,v 1.23 2003/08/05 13:13:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test the creation and use of tables that have a large number # of columns. # do_test misc1-1.1 { set cmd "CREATE TABLE manycol(x0 text" for {set i 1} {$i<=99} {incr i} { append cmd ",x$i text" } append cmd ")"; execsql $cmd set cmd "INSERT INTO manycol VALUES(0" for {set i 1} {$i<=99} {incr i} { append cmd ",$i" } append cmd ")"; execsql $cmd execsql "SELECT x99 FROM manycol" } 99 do_test misc1-1.2 { execsql {SELECT x0, x10, x25, x50, x75 FROM manycol} } {0 10 25 50 75} do_test misc1-1.3.1 { for {set j 100} {$j<=1000} {incr j 100} { set cmd "INSERT INTO manycol VALUES($j" for {set i 1} {$i<=99} {incr i} { append cmd ",[expr {$i+$j}]" } append cmd ")" execsql $cmd } execsql {SELECT x50 FROM manycol ORDER BY x80+0} } {50 150 250 350 450 550 650 750 850 950 1050} do_test misc1-1.3.2 { execsql {SELECT x50 FROM manycol ORDER BY x80} } {1050 150 250 350 450 550 650 750 50 850 950} do_test misc1-1.4 { execsql {SELECT x75 FROM manycol WHERE x50=350} } 375 do_test misc1-1.5 { execsql {SELECT x50 FROM manycol WHERE x99=599} } 550 do_test misc1-1.6 { execsql {CREATE INDEX manycol_idx1 ON manycol(x99)} execsql {SELECT x50 FROM manycol WHERE x99=899} } 850 do_test misc1-1.7 { execsql {SELECT count(*) FROM manycol} } 11 do_test misc1-1.8 { execsql {DELETE FROM manycol WHERE x98=1234} execsql {SELECT count(*) FROM manycol} } 11 do_test misc1-1.9 { execsql {DELETE FROM manycol WHERE x98=998} execsql {SELECT count(*) FROM manycol} } 10 do_test misc1-1.10 { execsql {DELETE FROM manycol WHERE x99=500} execsql {SELECT count(*) FROM manycol} } 10 do_test misc1-1.11 { execsql {DELETE FROM manycol WHERE x99=599} execsql {SELECT count(*) FROM manycol} } 9 # Check GROUP BY expressions that name two or more columns. # do_test misc1-2.1 { execsql { BEGIN TRANSACTION; CREATE TABLE agger(one text, two text, three text, four text); INSERT INTO agger VALUES(1, 'one', 'hello', 'yes'); INSERT INTO agger VALUES(2, 'two', 'howdy', 'no'); INSERT INTO agger VALUES(3, 'thr', 'howareya', 'yes'); INSERT INTO agger VALUES(4, 'two', 'lothere', 'yes'); INSERT INTO agger VALUES(5, 'one', 'atcha', 'yes'); INSERT INTO agger VALUES(6, 'two', 'hello', 'no'); COMMIT } execsql {SELECT count(*) FROM agger} } 6 do_test misc1-2.2 { execsql {SELECT sum(one), two, four FROM agger GROUP BY two, four ORDER BY sum(one) desc} } {8 two no 6 one yes 4 two yes 3 thr yes} do_test misc1-2.3 { execsql {SELECT sum((one)), (two), (four) FROM agger GROUP BY (two), (four) ORDER BY sum(one) desc} } {8 two no 6 one yes 4 two yes 3 thr yes} # Here's a test for a bug found by Joel Lucsy. The code below # was causing an assertion failure. # do_test misc1-3.1 { set r [execsql { CREATE TABLE t1(a); INSERT INTO t1 VALUES('hi'); PRAGMA full_column_names=on; SELECT rowid, * FROM t1; }] lindex $r 1 } {hi} # Here's a test for yet another bug found by Joel Lucsy. The code # below was causing an assertion failure. # do_test misc1-4.1 { execsql { BEGIN; CREATE TABLE t2(a); INSERT INTO t2 VALUES('This is a long string to use up a lot of disk -'); UPDATE t2 SET a=a||a||a||a; INSERT INTO t2 SELECT '1 - ' || a FROM t2; INSERT INTO t2 SELECT '2 - ' || a FROM t2; INSERT INTO t2 SELECT '3 - ' || a FROM t2; INSERT INTO t2 SELECT '4 - ' || a FROM t2; INSERT INTO t2 SELECT '5 - ' || a FROM t2; INSERT INTO t2 SELECT '6 - ' || a FROM t2; COMMIT; SELECT count(*) FROM t2; } } {64} # Make sure we actually see a semicolon or end-of-file in the SQL input # before executing a command. Thus if "WHERE" is misspelled on an UPDATE, # the user won't accidently update every record. # do_test misc1-5.1 { catchsql { CREATE TABLE t3(a,b); INSERT INTO t3 VALUES(1,2); INSERT INTO t3 VALUES(3,4); UPDATE t3 SET a=0 WHEREwww b=2; } } {1 {near "WHEREwww": syntax error}} do_test misc1-5.2 { execsql { SELECT * FROM t3 ORDER BY a; } } {1 2 3 4} # Certain keywords (especially non-standard keywords like "REPLACE") can # also be used as identifiers. The way this works in the parser is that # the parser first detects a syntax error, the error handling routine # sees that the special keyword caused the error, then replaces the keyword # with "ID" and tries again. # # Check the operation of this logic. # do_test misc1-6.1 { catchsql { CREATE TABLE t4( abort, asc, begin, cluster, conflict, copy, delimiters, desc, end, explain, fail, ignore, key, offset, pragma, replace, temp, vacuum, view ); } } {0 {}} do_test misc1-6.2 { catchsql { INSERT INTO t4 VALUES(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19); } } {0 {}} do_test misc1-6.3 { execsql { SELECT * FROM t4 } } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19} do_test misc1-6.4 { execsql { SELECT abort+asc,max(key,pragma,temp) FROM t4 } } {3 17} # Test for multi-column primary keys, and for multiple primary keys. # do_test misc1-7.1 { catchsql { CREATE TABLE error1( a TYPE PRIMARY KEY, b TYPE PRIMARY KEY ); } } {1 {table "error1" has more than one primary key}} do_test misc1-7.2 { catchsql { CREATE TABLE error1( a INTEGER PRIMARY KEY, b TYPE PRIMARY KEY ); } } {1 {table "error1" has more than one primary key}} do_test misc1-7.3 { execsql { CREATE TABLE t5(a,b,c,PRIMARY KEY(a,b)); INSERT INTO t5 VALUES(1,2,3); SELECT * FROM t5 ORDER BY a; } } {1 2 3} do_test misc1-7.4 { catchsql { INSERT INTO t5 VALUES(1,2,4); } } {1 {columns a, b are not unique}} do_test misc1-7.5 { catchsql { INSERT INTO t5 VALUES(0,2,4); } } {0 {}} do_test misc1-7.6 { execsql { SELECT * FROM t5 ORDER BY a; } } {0 2 4 1 2 3} do_test misc1-8.1 { catchsql { SELECT *; } } {1 {no tables specified}} do_test misc1-8.2 { catchsql { SELECT t1.*; } } {1 {no such table: t1}} execsql { DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; DROP TABLE t4; } # If an integer is too big to be represented as a 32-bit machine integer, # then treat it as a string. # do_test misc1-9.1 { catchsql { CREATE TABLE t1(a unique not null, b unique not null); INSERT INTO t1 VALUES('a',12345678901234567890); INSERT INTO t1 VALUES('b',12345678911234567890); INSERT INTO t1 VALUES('c',12345678921234567890); SELECT * FROM t1; } } {0 {a 12345678901234567890 b 12345678911234567890 c 12345678921234567890}} # A WHERE clause is not allowed to contain more than 99 terms. Check to # make sure this limit is enforced. # do_test misc1-10.0 { execsql {SELECT count(*) FROM manycol} } {9} do_test misc1-10.1 { set ::where {WHERE x0>=0} for {set i 1} {$i<=99} {incr i} { append ::where " AND x$i<>0" } catchsql "SELECT count(*) FROM manycol $::where" } {0 9} do_test misc1-10.2 { catchsql "SELECT count(*) FROM manycol $::where AND rowid>0" } {1 {WHERE clause too complex - no more than 100 terms allowed}} do_test misc1-10.3 { regsub "x0>=0" $::where "x0=0" ::where catchsql "DELETE FROM manycol $::where" } {0 {}} do_test misc1-10.4 { execsql {SELECT count(*) FROM manycol} } {8} do_test misc1-10.5 { catchsql "DELETE FROM manycol $::where AND rowid>0" } {1 {WHERE clause too complex - no more than 100 terms allowed}} do_test misc1-10.6 { execsql {SELECT x1 FROM manycol WHERE x0=100} } {101} do_test misc1-10.7 { regsub "x0=0" $::where "x0=100" ::where catchsql "UPDATE manycol SET x1=x1+1 $::where" } {0 {}} do_test misc1-10.8 { execsql {SELECT x1 FROM manycol WHERE x0=100} } {102} do_test misc1-10.9 { catchsql "UPDATE manycol SET x1=x1+1 $::where AND rowid>0" } {1 {WHERE clause too complex - no more than 100 terms allowed}} do_test misc1-10.10 { execsql {SELECT x1 FROM manycol WHERE x0=100} } {102} # Make sure the initialization works even if a database is opened while # another process has the database locked. # do_test misc1-11.1 { execsql {BEGIN} sqlite db2 test.db set rc [catch {db2 eval {SELECT count(*) FROM t1}} msg] lappend rc $msg } {1 {database is locked}} do_test misc1-11.2 { execsql {COMMIT} set rc [catch {db2 eval {SELECT count(*) FROM t1}} msg] db2 close lappend rc $msg } {0 3} # Make sure string comparisons really do compare strings in format4+. # Similar tests in the format3.test file show that for format3 and earlier # all comparisions where numeric if either operand looked like a number. # do_test misc1-12.1 { execsql {SELECT '0'=='0.0'} } {0} do_test misc1-12.2 { execsql {SELECT '0'==0.0} } {1} do_test misc1-12.3 { execsql {SELECT '12345678901234567890'=='12345678901234567891'} } {0} do_test misc1-12.4 { execsql { CREATE TABLE t6(a INT UNIQUE, b TEXT UNIQUE); INSERT INTO t6 VALUES('0','0.0'); SELECT * FROM t6; } } {0 0.0} do_test misc1-12.5 { execsql { INSERT OR IGNORE INTO t6 VALUES(0.0,'x'); SELECT * FROM t6; } } {0 0.0} do_test misc1-12.6 { execsql { INSERT OR IGNORE INTO t6 VALUES('y',0); SELECT * FROM t6; } } {0 0.0 y 0} do_test misc1-12.7 { execsql { CREATE TABLE t7(x INTEGER, y TEXT, z); INSERT INTO t7 VALUES(0,0,1); INSERT INTO t7 VALUES(0.0,0,2); INSERT INTO t7 VALUES(0,0.0,3); INSERT INTO t7 VALUES(0.0,0.0,4); SELECT DISTINCT x, y FROM t7 ORDER BY z; } } {0 0 0 0.0} do_test misc1-12.8 { execsql { SELECT min(z), max(z), count(z) FROM t7 GROUP BY x ORDER BY 1; } } {1 4 4} do_test misc1-12.9 { execsql { SELECT min(z), max(z), count(z) FROM t7 GROUP BY y ORDER BY 1; } } {1 2 2 3 4 2} # This used to be an error. But we changed the code so that arbitrary # identifiers can be used as a collating sequence. Collation is by text # if the identifier contains "text", "blob", or "clob" and is numeric # otherwise. do_test misc1-12.10 { catchsql { SELECT * FROM t6 ORDER BY a COLLATE unknown; } } {0 {0 0.0 y 0}} do_test misc1-12.11 { execsql { CREATE TABLE t8(x TEXT COLLATE numeric, y INTEGER COLLATE text, z); INSERT INTO t8 VALUES(0,0,1); INSERT INTO t8 VALUES(0.0,0,2); INSERT INTO t8 VALUES(0,0.0,3); INSERT INTO t8 VALUES(0.0,0.0,4); SELECT DISTINCT x, y FROM t8 ORDER BY z; } } {0 0 0 0.0} do_test misc1-12.12 { execsql { SELECT min(z), max(z), count(z) FROM t8 GROUP BY x ORDER BY 1; } } {1 4 4} do_test misc1-12.13 { execsql { SELECT min(z), max(z), count(z) FROM t8 GROUP BY y ORDER BY 1; } } {1 2 2 3 4 2} # There was a problem with realloc() in the OP_MemStore operation of # the VDBE. A buffer was being reallocated but some pointers into # the old copy of the buffer were not being moved over to the new copy. # The following code tests for the problem. # do_test misc1-13.1 { execsql { CREATE TABLE t9(x,y); INSERT INTO t9 VALUES('one',1); INSERT INTO t9 VALUES('two',2); INSERT INTO t9 VALUES('three',3); INSERT INTO t9 VALUES('four',4); INSERT INTO t9 VALUES('five',5); INSERT INTO t9 VALUES('six',6); INSERT INTO t9 VALUES('seven',7); INSERT INTO t9 VALUES('eight',8); INSERT INTO t9 VALUES('nine',9); INSERT INTO t9 VALUES('ten',10); INSERT INTO t9 VALUES('eleven',11); SELECT y FROM t9 WHERE x=(SELECT x FROM t9 WHERE y=1) OR x=(SELECT x FROM t9 WHERE y=2) OR x=(SELECT x FROM t9 WHERE y=3) OR x=(SELECT x FROM t9 WHERE y=4) OR x=(SELECT x FROM t9 WHERE y=5) OR x=(SELECT x FROM t9 WHERE y=6) OR x=(SELECT x FROM t9 WHERE y=7) OR x=(SELECT x FROM t9 WHERE y=8) OR x=(SELECT x FROM t9 WHERE y=9) OR x=(SELECT x FROM t9 WHERE y=10) OR x=(SELECT x FROM t9 WHERE y=11) OR x=(SELECT x FROM t9 WHERE y=12) OR x=(SELECT x FROM t9 WHERE y=13) OR x=(SELECT x FROM t9 WHERE y=14) ; } } {1 2 3 4 5 6 7 8 9 10 11} # Make sure a database connection still works after changing the # working directory. # do_test misc1-14.1 { file mkdir tempdir cd tempdir execsql {BEGIN} file exists ./test.db-journal } {0} do_test misc1-14.2 { file exists ../test.db-journal } {1} do_test misc1-14.3 { cd .. file delete tempdir execsql {COMMIT} file exists ./test.db-journal } {0} # A failed create table should not leave the table in the internal # data structures. Ticket #238. # do_test misc1-15.1 { catchsql { CREATE TABLE t10 AS SELECT c1; } } {1 {no such column: c1}} do_test misc1-15.2 { catchsql { CREATE TABLE t10 AS SELECT 1; } # The bug in ticket #238 causes the statement above to fail with # the error "table t10 alread exists" } {0 {}} # Test for memory leaks when a CREATE TABLE containing a primary key # fails. Ticket #249. # do_test misc1-16.1 { catchsql {SELECT name FROM sqlite_master LIMIT 1} catchsql { CREATE TABLE test(a integer, primary key(a)); } } {0 {}} do_test misc1-16.2 { catchsql { CREATE TABLE test(a integer, primary key(a)); } } {1 {table test already exists}} do_test misc1-16.3 { catchsql { CREATE TABLE test2(a text primary key, b text, primary key(a,b)); } } {1 {table "test2" has more than one primary key}} do_test misc1-16.4 { execsql { INSERT INTO test VALUES(1); SELECT rowid, a FROM test; } } {1 1} do_test misc1-16.5 { execsql { INSERT INTO test VALUES(5); SELECT rowid, a FROM test; } } {1 1 5 5} do_test misc1-16.6 { execsql { INSERT INTO test VALUES(NULL); SELECT rowid, a FROM test; } } {1 1 5 5 6 6} # Ticket #333: Temp triggers that modify persistent tables. # do_test misc1-17.1 { execsql { BEGIN; CREATE TABLE RealTable(TestID INTEGER PRIMARY KEY, TestString TEXT); CREATE TEMP TABLE TempTable(TestID INTEGER PRIMARY KEY, TestString TEXT); CREATE TEMP TRIGGER trigTest_1 AFTER UPDATE ON TempTable BEGIN INSERT INTO RealTable(TestString) SELECT new.TestString FROM TempTable LIMIT 1; END; INSERT INTO TempTable(TestString) VALUES ('1'); INSERT INTO TempTable(TestString) VALUES ('2'); UPDATE TempTable SET TestString = TestString + 1 WHERE TestID IN (1, 2); COMMIT; SELECT TestString FROM RealTable ORDER BY 1; } } {2 3} finish_test sqlite-2.8.17/test/ioerr.test0000644000175000001440000000720510232547612016054 0ustar drhusers00000000000000# 2001 October 12 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing for correct handling of I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # # $Id: ioerr.test,v 1.3 2003/04/25 15:37:59 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set ::go 1 for {set n 1} {$go} {incr n} { do_test ioerr-1.$n.1 { set ::sqlite_io_error_pending 0 db close catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite db test.db execsql {SELECT * FROM sqlite_master} } {} do_test ioerr-1.$n.2 [subst { set ::sqlite_io_error_pending $n }] $n do_test ioerr-1.$n.3 { set r [catch {db eval { CREATE TABLE t1(a,b,c); SELECT * FROM sqlite_master; BEGIN TRANSACTION; INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(4,5,6); ROLLBACK; SELECT * FROM t1; BEGIN TRANSACTION; INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(4,5,6); COMMIT; SELECT * FROM t1; DELETE FROM t1 WHERE a<100; }} msg] # if {$r} {puts $msg} set ::go [expr {$::sqlite_io_error_pending<=0}] expr {$::sqlite_io_error_pending>0 || $r!=0} } {1} } set ::sqlite_io_error_pending 0 proc cksum {{db db}} { set txt [$db eval {SELECT name, type, sql FROM sqlite_master}]\n foreach tbl [$db eval {SELECT name FROM sqlite_master WHERE type='table'}] { append txt [$db eval "SELECT * FROM $tbl"]\n } foreach prag {default_synchronous default_cache_size} { append txt $prag-[$db eval "PRAGMA $prag"]\n } set cksum [string length $txt]-[md5 $txt] # puts $cksum-[file size test.db] return $cksum } set ::go 1 for {set n 1} {$go} {incr n} { do_test ioerr-2.$n.1 { set ::sqlite_io_error_pending 0 db close catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite db test.db execsql { BEGIN; CREATE TABLE t1(a, b, c); INSERT INTO t1 VALUES(1, randstr(5,50), randstr(5,50)); INSERT INTO t1 SELECT a+2, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT a+4, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT a+8, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT a+16, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT a+32, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT a+64, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT a+128, b||'-'||rowid, c||'-'||rowid FROM t1; CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t3 AS SELECT * FROM t1; COMMIT; DROP TABLE t2; } set ::cksum [cksum] execsql { SELECT name FROM sqlite_master WHERE type='table' } } {t1 t3} do_test ioerr-2.$n.2 [subst { set ::sqlite_io_error_pending $n }] $n do_test ioerr-2.$n.3 { set r [catch {db eval { VACUUM; }} msg] # puts "error_pending=$::sqlite_io_error_pending" # if {$r} {puts $msg} set ::go [expr {$::sqlite_io_error_pending<=0}] expr {$::sqlite_io_error_pending>0 || $r!=0} set ::sqlite_io_error_pending 0 db close sqlite db test.db cksum } $cksum } set ::sqlite_io_error_pending 0 finish_test sqlite-2.8.17/test/misc2.test0000644000175000001440000001345610232547612015756 0ustar drhusers00000000000000# 2003 June 21 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # # $Id: misc2.test,v 1.11 2003/12/17 23:57:36 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test for ticket #360 # do_test misc2-1.1 { catchsql { CREATE TABLE FOO(bar integer); CREATE TRIGGER foo_insert BEFORE INSERT ON foo BEGIN SELECT CASE WHEN (NOT new.bar BETWEEN 0 AND 20) THEN raise(rollback, 'aiieee') END; END; INSERT INTO foo(bar) VALUES (1); } } {0 {}} do_test misc2-1.2 { catchsql { INSERT INTO foo(bar) VALUES (111); } } {1 aiieee} # Make sure ROWID works on a view and a subquery. Ticket #364 # do_test misc2-2.1 { execsql { CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3); CREATE TABLE t2(a,b,c); INSERT INTO t2 VALUES(7,8,9); SELECT rowid, * FROM (SELECT * FROM t1, t2); } } {{} 1 2 3 7 8 9} do_test misc2-2.2 { execsql { CREATE VIEW v1 AS SELECT * FROM t1, t2; SELECT rowid, * FROM v1; } } {{} 1 2 3 7 8 9} # Check name binding precedence. Ticket #387 # do_test misc2-3.1 { catchsql { SELECT t1.b+t2.b AS a, t1.a, t2.a FROM t1, t2 WHERE a==10 } } {1 {ambiguous column name: a}} # Make sure 32-bit integer overflow is handled properly in queries. # ticket #408 # do_test misc2-4.1 { execsql { INSERT INTO t1 VALUES(4000000000,'a','b'); SELECT a FROM t1 WHERE a>1; } } {4000000000} do_test misc2-4.2 { execsql { INSERT INTO t1 VALUES(2147483648,'b2','c2'); INSERT INTO t1 VALUES(2147483647,'b3','c3'); SELECT a FROM t1 WHERE a>2147483647; } } {4000000000 2147483648} do_test misc2-4.3 { execsql { SELECT a FROM t1 WHERE a<2147483648; } } {1 2147483647} do_test misc2-4.4 { execsql { SELECT a FROM t1 WHERE a<=2147483648; } } {1 2147483648 2147483647} do_test misc2-4.5 { execsql { SELECT a FROM t1 WHERE a<10000000000; } } {1 4000000000 2147483648 2147483647} do_test misc2-4.6 { execsql { SELECT a FROM t1 WHERE a<1000000000000 ORDER BY 1; } } {1 2147483647 2147483648 4000000000} # There were some issues with expanding a SrcList object using a call # to sqliteSrcListAppend() if the SrcList had previously been duplicated # using a call to sqliteSrcListDup(). Ticket #416. The following test # makes sure the problem has been fixed. # do_test misc2-5.1 { execsql { CREATE TABLE x(a,b); CREATE VIEW y AS SELECT x1.b AS p, x2.b AS q FROM x AS x1, x AS x2 WHERE x1.a=x2.a; CREATE VIEW z AS SELECT y1.p, y2.p FROM y AS y1, y AS y2 WHERE y1.q=y2.q; SELECT * from z; } } {} # Make sure we can open a database with an empty filename. What this # does is store the database in a temporary file that is deleted when # the database is closed. Ticket #432. # do_test misc2-6.1 { db close sqlite db {} execsql { CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); SELECT * FROM t1; } } {1 2} # Make sure we get an error message (not a segfault) on an attempt to # update a table from within the callback of a select on that same # table. # do_test misc2-7.1 { db close file delete -force test.db sqlite db test.db execsql { CREATE TABLE t1(x); INSERT INTO t1 VALUES(1); } set rc [catch { db eval {SELECT rowid FROM t1} {} { db eval "DELETE FROM t1 WHERE rowid=$rowid" } } msg] lappend rc $msg } {1 {database table is locked}} do_test misc2-7.2 { set rc [catch { db eval {SELECT rowid FROM t1} {} { db eval "INSERT INTO t1 VALUES(3)" } } msg] lappend rc $msg } {1 {database table is locked}} do_test misc2-7.3 { db close file delete -force test.db sqlite db :memory: execsql { CREATE TABLE t1(x); INSERT INTO t1 VALUES(1); } set rc [catch { db eval {SELECT rowid FROM t1} {} { db eval "DELETE FROM t1 WHERE rowid=$rowid" } } msg] lappend rc $msg } {1 {database table is locked}} do_test misc2-7.4 { set rc [catch { db eval {SELECT rowid FROM t1} {} { db eval "INSERT INTO t1 VALUES(3)" } } msg] lappend rc $msg } {1 {database table is locked}} # Ticket #453. If the SQL ended with "-", the tokenizer was calling that # an incomplete token, which caused problem. The solution was to just call # it a minus sign. # do_test misc2-8.1 { catchsql {-} } {1 {near "-": syntax error}} # Ticket #513. Make sure the VDBE stack does not grow on a 3-way join. # do_test misc2-9.1 { execsql { BEGIN; CREATE TABLE counts(n INTEGER PRIMARY KEY); INSERT INTO counts VALUES(0); INSERT INTO counts VALUES(1); INSERT INTO counts SELECT n+2 FROM counts; INSERT INTO counts SELECT n+4 FROM counts; INSERT INTO counts SELECT n+8 FROM counts; COMMIT; CREATE TEMP TABLE x AS SELECT dim1.n, dim2.n, dim3.n FROM counts AS dim1, counts AS dim2, counts AS dim3 WHERE dim1.n<10 AND dim2.n<10 AND dim3.n<10; SELECT count(*) FROM x; } } {1000} do_test misc2-9.2 { execsql { DROP TABLE x; CREATE TEMP TABLE x AS SELECT dim1.n, dim2.n, dim3.n FROM counts AS dim1, counts AS dim2, counts AS dim3 WHERE dim1.n>=6 AND dim2.n>=6 AND dim3.n>=6; SELECT count(*) FROM x; } } {1000} do_test misc2-9.3 { execsql { DROP TABLE x; CREATE TEMP TABLE x AS SELECT dim1.n, dim2.n, dim3.n, dim4.n FROM counts AS dim1, counts AS dim2, counts AS dim3, counts AS dim4 WHERE dim1.n<5 AND dim2.n<5 AND dim3.n<5 AND dim4.n<5; SELECT count(*) FROM x; } } [expr 5*5*5*5] finish_test sqlite-2.8.17/test/index.test0000644000175000001440000003275110232547612016047 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE INDEX statement. # # $Id: index.test,v 1.24.2.1 2004/07/20 00:50:30 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a basic index and verify it is added to sqlite_master # do_test index-1.1 { execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)} execsql {CREATE INDEX index1 ON test1(f1)} execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {index1 test1} do_test index-1.1b { execsql {SELECT name, sql, tbl_name, type FROM sqlite_master WHERE name='index1'} } {index1 {CREATE INDEX index1 ON test1(f1)} test1 index} do_test index-1.1c { db close sqlite db test.db execsql {SELECT name, sql, tbl_name, type FROM sqlite_master WHERE name='index1'} } {index1 {CREATE INDEX index1 ON test1(f1)} test1 index} do_test index-1.1d { db close sqlite db test.db execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {index1 test1} # Verify that the index dies with the table # do_test index-1.2 { execsql {DROP TABLE test1} execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {} # Try adding an index to a table that does not exist # do_test index-2.1 { set v [catch {execsql {CREATE INDEX index1 ON test1(f1)}} msg] lappend v $msg } {1 {no such table: test1}} # Try adding an index on a column of a table where the table # exists but the column does not. # do_test index-2.1 { execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)} set v [catch {execsql {CREATE INDEX index1 ON test1(f4)}} msg] lappend v $msg } {1 {table test1 has no column named f4}} # Try an index with some columns that match and others that do now. # do_test index-2.2 { set v [catch {execsql {CREATE INDEX index1 ON test1(f1, f2, f4, f3)}} msg] execsql {DROP TABLE test1} lappend v $msg } {1 {table test1 has no column named f4}} # Try creating a bunch of indices on the same table # set r {} for {set i 1} {$i<100} {incr i} { lappend r [format index%02d $i] } do_test index-3.1 { execsql {CREATE TABLE test1(f1 int, f2 int, f3 int, f4 int, f5 int)} for {set i 1} {$i<100} {incr i} { set sql "CREATE INDEX [format index%02d $i] ON test1(f[expr {($i%5)+1}])" execsql $sql } execsql {SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='test1' ORDER BY name} } $r # Verify that all the indices go away when we drop the table. # do_test index-3.3 { execsql {DROP TABLE test1} execsql {SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='test1' ORDER BY name} } {} # Create a table and insert values into that table. Then create # an index on that table. Verify that we can select values # from the table correctly using the index. # # Note that the index names "index9" and "indext" are chosen because # they both have the same hash. # do_test index-4.1 { execsql {CREATE TABLE test1(cnt int, power int)} for {set i 1} {$i<20} {incr i} { execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])" } execsql {CREATE INDEX index9 ON test1(cnt)} execsql {CREATE INDEX indext ON test1(power)} execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {index9 indext test1} do_test index-4.2 { execsql {SELECT cnt FROM test1 WHERE power=4} } {2} do_test index-4.3 { execsql {SELECT cnt FROM test1 WHERE power=1024} } {10} do_test index-4.4 { execsql {SELECT power FROM test1 WHERE cnt=6} } {64} do_test index-4.5 { execsql {DROP INDEX indext} execsql {SELECT power FROM test1 WHERE cnt=6} } {64} do_test index-4.6 { execsql {SELECT cnt FROM test1 WHERE power=1024} } {10} do_test index-4.7 { execsql {CREATE INDEX indext ON test1(cnt)} execsql {SELECT power FROM test1 WHERE cnt=6} } {64} do_test index-4.8 { execsql {SELECT cnt FROM test1 WHERE power=1024} } {10} do_test index-4.9 { execsql {DROP INDEX index9} execsql {SELECT power FROM test1 WHERE cnt=6} } {64} do_test index-4.10 { execsql {SELECT cnt FROM test1 WHERE power=1024} } {10} do_test index-4.11 { execsql {DROP INDEX indext} execsql {SELECT power FROM test1 WHERE cnt=6} } {64} do_test index-4.12 { execsql {SELECT cnt FROM test1 WHERE power=1024} } {10} do_test index-4.13 { execsql {DROP TABLE test1} execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {} integrity_check index-4.14 # Do not allow indices to be added to sqlite_master # do_test index-5.1 { set v [catch {execsql {CREATE INDEX index1 ON sqlite_master(name)}} msg] lappend v $msg } {1 {table sqlite_master may not be indexed}} do_test index-5.2 { execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {} # Do not allow indices with duplicate names to be added # do_test index-6.1 { execsql {CREATE TABLE test1(f1 int, f2 int)} execsql {CREATE TABLE test2(g1 real, g2 real)} execsql {CREATE INDEX index1 ON test1(f1)} set v [catch {execsql {CREATE INDEX index1 ON test2(g1)}} msg] lappend v $msg } {1 {index index1 already exists}} do_test index-6.1b { execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {index1 test1 test2} do_test index-6.2 { set v [catch {execsql {CREATE INDEX test1 ON test2(g1)}} msg] lappend v $msg } {1 {there is already a table named test1}} do_test index-6.2b { execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {index1 test1 test2} do_test index-6.3 { execsql {DROP TABLE test1} execsql {DROP TABLE test2} execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {} do_test index-6.4 { execsql { CREATE TABLE test1(a,b); CREATE INDEX index1 ON test1(a); CREATE INDEX index2 ON test1(b); CREATE INDEX index3 ON test1(a,b); DROP TABLE test1; SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name; } } {} integrity_check index-6.5 # Create a primary key # do_test index-7.1 { execsql {CREATE TABLE test1(f1 int, f2 int primary key)} for {set i 1} {$i<20} {incr i} { execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])" } execsql {SELECT count(*) FROM test1} } {19} do_test index-7.2 { execsql {SELECT f1 FROM test1 WHERE f2=65536} } {16} do_test index-7.3 { execsql { SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='test1' } } {{(test1 autoindex 1)}} do_test index-7.4 { execsql {DROP table test1} execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {} integrity_check index-7.5 # Make sure we cannot drop a non-existant index. # do_test index-8.1 { set v [catch {execsql {DROP INDEX index1}} msg] lappend v $msg } {1 {no such index: index1}} # Make sure we don't actually create an index when the EXPLAIN keyword # is used. # do_test index-9.1 { execsql {CREATE TABLE tab1(a int)} execsql {EXPLAIN CREATE INDEX idx1 ON tab1(a)} execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1'} } {tab1} do_test index-9.2 { execsql {CREATE INDEX idx1 ON tab1(a)} execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1' ORDER BY name} } {idx1 tab1} integrity_check index-9.3 # Allow more than one entry with the same key. # do_test index-10.0 { execsql { CREATE TABLE t1(a int, b int); CREATE INDEX i1 ON t1(a); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(2,4); INSERT INTO t1 VALUES(3,8); INSERT INTO t1 VALUES(1,12); SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {2 12} do_test index-10.1 { execsql { SELECT b FROM t1 WHERE a=2 ORDER BY b; } } {4} do_test index-10.2 { execsql { DELETE FROM t1 WHERE b=12; SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {2} do_test index-10.3 { execsql { DELETE FROM t1 WHERE b=2; SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {} do_test index-10.4 { execsql { DELETE FROM t1; INSERT INTO t1 VALUES (1,1); INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (1,3); INSERT INTO t1 VALUES (1,4); INSERT INTO t1 VALUES (1,5); INSERT INTO t1 VALUES (1,6); INSERT INTO t1 VALUES (1,7); INSERT INTO t1 VALUES (1,8); INSERT INTO t1 VALUES (1,9); INSERT INTO t1 VALUES (2,0); SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {1 2 3 4 5 6 7 8 9} do_test index-10.5 { execsql { DELETE FROM t1 WHERE b IN (2, 4, 6, 8); SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {1 3 5 7 9} do_test index-10.6 { execsql { DELETE FROM t1 WHERE b>2; SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {1} do_test index-10.7 { execsql { DELETE FROM t1 WHERE b=1; SELECT b FROM t1 WHERE a=1 ORDER BY b; } } {} do_test index-10.8 { execsql { SELECT b FROM t1 ORDER BY b; } } {0} integrity_check index-10.9 # Automatically create an index when we specify a primary key. # do_test index-11.1 { execsql { CREATE TABLE t3( a text, b int, c float, PRIMARY KEY(b) ); } for {set i 1} {$i<=50} {incr i} { execsql "INSERT INTO t3 VALUES('x${i}x',$i,0.$i)" } set sqlite_search_count 0 concat [execsql {SELECT c FROM t3 WHERE b==10}] $sqlite_search_count } {0.10 3} integrity_check index-11.2 # Numeric strings should compare as if they were numbers. So even if the # strings are not character-by-character the same, if they represent the # same number they should compare equal to one another. Verify that this # is true in indices. # do_test index-12.1 { execsql { CREATE TABLE t4(a,b); INSERT INTO t4 VALUES('0.0',1); INSERT INTO t4 VALUES('0.00',2); INSERT INTO t4 VALUES('abc',3); INSERT INTO t4 VALUES('-1.0',4); INSERT INTO t4 VALUES('+1.0',5); INSERT INTO t4 VALUES('0',6); INSERT INTO t4 VALUES('00000',7); SELECT a FROM t4 ORDER BY b; } } {0.0 0.00 abc -1.0 +1.0 0 00000} do_test index-12.2 { execsql { SELECT a FROM t4 WHERE a==0 ORDER BY b } } {0.0 0.00 0 00000} do_test index-12.3 { execsql { SELECT a FROM t4 WHERE a<0.5 ORDER BY b } } {0.0 0.00 -1.0 0 00000} do_test index-12.4 { execsql { SELECT a FROM t4 WHERE a>-0.5 ORDER BY b } } {0.0 0.00 abc +1.0 0 00000} do_test index-12.5 { execsql { CREATE INDEX t4i1 ON t4(a); SELECT a FROM t4 WHERE a==0 ORDER BY b } } {0.0 0.00 0 00000} do_test index-12.6 { execsql { SELECT a FROM t4 WHERE a<0.5 ORDER BY b } } {0.0 0.00 -1.0 0 00000} do_test index-12.7 { execsql { SELECT a FROM t4 WHERE a>-0.5 ORDER BY b } } {0.0 0.00 abc +1.0 0 00000} integrity_check index-12.8 # Make sure we cannot drop an automatically created index. # do_test index-13.1 { execsql { CREATE TABLE t5( a int UNIQUE, b float PRIMARY KEY, c varchar(10), UNIQUE(a,c) ); INSERT INTO t5 VALUES(1,2,3); SELECT * FROM t5; } } {1 2 3} do_test index-13.2 { set ::idxlist [execsql { SELECT name FROM sqlite_master WHERE type="index" AND tbl_name="t5"; }] llength $::idxlist } {3} for {set i 0} {$i<[llength $::idxlist]} {incr i} { do_test index-13.3.$i { catchsql " DROP INDEX '[lindex $::idxlist $i]'; " } {1 {index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped}} } do_test index-13.4 { execsql { INSERT INTO t5 VALUES('a','b','c'); SELECT * FROM t5; } } {1 2 3 a b c} integrity_check index-13.5 # Check the sort order of data in an index. # do_test index-14.1 { execsql { CREATE TABLE t6(a,b,c); CREATE INDEX t6i1 ON t6(a,b); INSERT INTO t6 VALUES('','',1); INSERT INTO t6 VALUES('',NULL,2); INSERT INTO t6 VALUES(NULL,'',3); INSERT INTO t6 VALUES('abc',123,4); INSERT INTO t6 VALUES(123,'abc',5); SELECT c FROM t6 ORDER BY a,b; } } {3 5 2 1 4} do_test index-14.2 { execsql { SELECT c FROM t6 WHERE a=''; } } {2 1} do_test index-14.3 { execsql { SELECT c FROM t6 WHERE b=''; } } {1 3} do_test index-14.4 { execsql { SELECT c FROM t6 WHERE a>''; } } {4} do_test index-14.5 { execsql { SELECT c FROM t6 WHERE a>=''; } } {2 1 4} do_test index-14.6 { execsql { SELECT c FROM t6 WHERE a>123; } } {2 1 4} do_test index-14.7 { execsql { SELECT c FROM t6 WHERE a>=123; } } {5 2 1 4} do_test index-14.8 { execsql { SELECT c FROM t6 WHERE a<'abc'; } } {5 2 1} do_test index-14.9 { execsql { SELECT c FROM t6 WHERE a<='abc'; } } {5 2 1 4} do_test index-14.10 { execsql { SELECT c FROM t6 WHERE a<=''; } } {5 2 1} do_test index-14.11 { execsql { SELECT c FROM t6 WHERE a<''; } } {5} integrity_check index-14.12 do_test index-15.1 { execsql { DELETE FROM t1; SELECT * FROM t1; } } {} do_test index-15.2 { execsql { INSERT INTO t1 VALUES('1.234e5',1); INSERT INTO t1 VALUES('12.33e04',2); INSERT INTO t1 VALUES('12.35E4',3); INSERT INTO t1 VALUES('12.34e',4); INSERT INTO t1 VALUES('12.32e+4',5); INSERT INTO t1 VALUES('12.36E+04',6); INSERT INTO t1 VALUES('12.36E+',7); INSERT INTO t1 VALUES('+123.10000E+0003',8); INSERT INTO t1 VALUES('+',9); INSERT INTO t1 VALUES('+12347.E+02',10); INSERT INTO t1 VALUES('+12347E+02',11); SELECT b FROM t1 ORDER BY a; } } {8 5 2 1 3 6 11 9 10 4 7} integrity_check index-15.1 # Drop index with a quoted name. Ticket #695. # do_test index-16.1 { execsql { CREATE INDEX "t6i2" ON t6(c); DROP INDEX "t6i2"; } } {} do_test index-16.2 { execsql { DROP INDEX "t6i1"; } } {} finish_test sqlite-2.8.17/test/table.test0000644000175000001440000003023110232547612016016 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # # $Id: table.test,v 1.22 2003/01/29 18:46:54 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a basic table and verify it is added to sqlite_master # do_test table-1.1 { execsql { CREATE TABLE test1 ( one varchar(10), two text ) } execsql { SELECT sql FROM sqlite_master WHERE type!='meta' } } {{CREATE TABLE test1 ( one varchar(10), two text )}} # Verify the other fields of the sqlite_master file. # do_test table-1.3 { execsql {SELECT name, tbl_name, type FROM sqlite_master WHERE type!='meta'} } {test1 test1 table} # Close and reopen the database. Verify that everything is # still the same. # do_test table-1.4 { db close sqlite db test.db execsql {SELECT name, tbl_name, type from sqlite_master WHERE type!='meta'} } {test1 test1 table} # Drop the database and make sure it disappears. # do_test table-1.5 { execsql {DROP TABLE test1} execsql {SELECT * FROM sqlite_master WHERE type!='meta'} } {} # Close and reopen the database. Verify that the table is # still gone. # do_test table-1.6 { db close sqlite db test.db execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {} # Repeat the above steps, but this time quote the table name. # do_test table-1.10 { execsql {CREATE TABLE "create" (f1 int)} execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {create} do_test table-1.11 { execsql {DROP TABLE "create"} execsql {SELECT name FROM "sqlite_master" WHERE type!='meta'} } {} do_test table-1.12 { execsql {CREATE TABLE test1("f1 ho" int)} execsql {SELECT name as "X" FROM sqlite_master WHERE type!='meta'} } {test1} do_test table-1.13 { execsql {DROP TABLE "TEST1"} execsql {SELECT name FROM "sqlite_master" WHERE type!='meta'} } {} # Verify that we cannot make two tables with the same name # do_test table-2.1 { execsql {CREATE TABLE TEST2(one text)} set v [catch {execsql {CREATE TABLE test2(two text)}} msg] lappend v $msg } {1 {table test2 already exists}} do_test table-2.1b { set v [catch {execsql {CREATE TABLE sqlite_master(two text)}} msg] lappend v $msg } {1 {table sqlite_master already exists}} do_test table-2.1c { db close sqlite db test.db set v [catch {execsql {CREATE TABLE sqlite_master(two text)}} msg] lappend v $msg } {1 {table sqlite_master already exists}} do_test table-2.1d { execsql {DROP TABLE test2; SELECT name FROM sqlite_master WHERE type!='meta'} } {} # Verify that we cannot make a table with the same name as an index # do_test table-2.2a { execsql {CREATE TABLE test2(one text); CREATE INDEX test3 ON test2(one)} set v [catch {execsql {CREATE TABLE test3(two text)}} msg] lappend v $msg } {1 {there is already an index named test3}} do_test table-2.2b { db close sqlite db test.db set v [catch {execsql {CREATE TABLE test3(two text)}} msg] lappend v $msg } {1 {there is already an index named test3}} do_test table-2.2c { execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {test2 test3} do_test table-2.2d { execsql {DROP INDEX test3} set v [catch {execsql {CREATE TABLE test3(two text)}} msg] lappend v $msg } {0 {}} do_test table-2.2e { execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {test2 test3} do_test table-2.2f { execsql {DROP TABLE test2; DROP TABLE test3} execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {} # Create a table with many field names # set big_table \ {CREATE TABLE big( f1 varchar(20), f2 char(10), f3 varchar(30) primary key, f4 text, f5 text, f6 text, f7 text, f8 text, f9 text, f10 text, f11 text, f12 text, f13 text, f14 text, f15 text, f16 text, f17 text, f18 text, f19 text, f20 text )} do_test table-3.1 { execsql $big_table execsql {SELECT sql FROM sqlite_master WHERE type=='table'} } \{$big_table\} do_test table-3.2 { set v [catch {execsql {CREATE TABLE BIG(xyz foo)}} msg] lappend v $msg } {1 {table BIG already exists}} do_test table-3.3 { set v [catch {execsql {CREATE TABLE biG(xyz foo)}} msg] lappend v $msg } {1 {table biG already exists}} do_test table-3.4 { set v [catch {execsql {CREATE TABLE bIg(xyz foo)}} msg] lappend v $msg } {1 {table bIg already exists}} do_test table-3.5 { db close sqlite db test.db set v [catch {execsql {CREATE TABLE Big(xyz foo)}} msg] lappend v $msg } {1 {table Big already exists}} do_test table-3.6 { execsql {DROP TABLE big} execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {} # Try creating large numbers of tables # set r {} for {set i 1} {$i<=100} {incr i} { lappend r [format test%03d $i] } do_test table-4.1 { for {set i 1} {$i<=100} {incr i} { set sql "CREATE TABLE [format test%03d $i] (" for {set k 1} {$k<$i} {incr k} { append sql "field$k text," } append sql "last_field text)" execsql $sql } execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } $r do_test table-4.1b { db close sqlite db test.db execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } $r # Drop the even numbered tables # set r {} for {set i 1} {$i<=100} {incr i 2} { lappend r [format test%03d $i] } do_test table-4.2 { for {set i 2} {$i<=100} {incr i 2} { # if {$i==38} {execsql {pragma vdbe_trace=on}} set sql "DROP TABLE [format TEST%03d $i]" execsql $sql } execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } $r #exit # Drop the odd number tables # do_test table-4.3 { for {set i 1} {$i<=100} {incr i 2} { set sql "DROP TABLE [format test%03d $i]" execsql $sql } execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} } {} # Try to drop a table that does not exist # do_test table-5.1 { set v [catch {execsql {DROP TABLE test009}} msg] lappend v $msg } {1 {no such table: test009}} # Try to drop sqlite_master # do_test table-5.2 { set v [catch {execsql {DROP TABLE sqlite_master}} msg] lappend v $msg } {1 {table sqlite_master may not be dropped}} # Make sure an EXPLAIN does not really create a new table # do_test table-5.3 { execsql {EXPLAIN CREATE TABLE test1(f1 int)} execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {} # Make sure an EXPLAIN does not really drop an existing table # do_test table-5.4 { execsql {CREATE TABLE test1(f1 int)} execsql {EXPLAIN DROP TABLE test1} execsql {SELECT name FROM sqlite_master WHERE type!='meta'} } {test1} # Create a table with a goofy name # #do_test table-6.1 { # execsql {CREATE TABLE 'Spaces In This Name!'(x int)} # execsql {INSERT INTO 'spaces in this name!' VALUES(1)} # set list [glob -nocomplain testdb/spaces*.tbl] #} {testdb/spaces+in+this+name+.tbl} # Try using keywords as table names or column names. # do_test table-7.1 { set v [catch {execsql { CREATE TABLE weird( desc text, asc text, explain int, [14_vac] boolean, fuzzy_dog_12 varchar(10), begin blob, end clob ) }} msg] lappend v $msg } {0 {}} do_test table-7.2 { execsql { INSERT INTO weird VALUES('a','b',9,0,'xyz','hi','y''all'); SELECT * FROM weird; } } {a b 9 0 xyz hi y'all} do_test table-7.3 { execsql2 { SELECT * FROM weird; } } {desc a asc b explain 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all} # Try out the CREATE TABLE AS syntax # do_test table-8.1 { execsql2 { CREATE TABLE t2 AS SELECT * FROM weird; SELECT * FROM t2; } } {desc a asc b explain 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all} do_test table-8.1.1 { execsql { SELECT sql FROM sqlite_master WHERE name='t2'; } } {{CREATE TABLE t2( 'desc', 'asc', 'explain', '14_vac', fuzzy_dog_12, 'begin', 'end' )}} do_test table-8.2 { execsql { CREATE TABLE 't3''xyz'(a,b,c); INSERT INTO [t3'xyz] VALUES(1,2,3); SELECT * FROM [t3'xyz]; } } {1 2 3} do_test table-8.3 { execsql2 { CREATE TABLE [t4'abc] AS SELECT count(*) as cnt, max(b+c) FROM [t3'xyz]; SELECT * FROM [t4'abc]; } } {cnt 1 max(b+c) 5} do_test table-8.3.1 { execsql { SELECT sql FROM sqlite_master WHERE name='t4''abc' } } {{CREATE TABLE 't4''abc'(cnt,'max(b+c)')}} do_test table-8.4 { execsql2 { CREATE TEMPORARY TABLE t5 AS SELECT count(*) AS [y'all] FROM [t3'xyz]; SELECT * FROM t5; } } {y'all 1} do_test table-8.5 { db close sqlite db test.db execsql2 { SELECT * FROM [t4'abc]; } } {cnt 1 max(b+c) 5} do_test table-8.6 { execsql2 { SELECT * FROM t2; } } {desc a asc b explain 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all} do_test table-8.7 { catchsql { SELECT * FROM t5; } } {1 {no such table: t5}} do_test table-8.8 { catchsql { CREATE TABLE t5 AS SELECT * FROM no_such_table; } } {1 {no such table: no_such_table}} # Make sure we cannot have duplicate column names within a table. # do_test table-9.1 { catchsql { CREATE TABLE t6(a,b,a); } } {1 {duplicate column name: a}} # Check the foreign key syntax. # do_test table-10.1 { catchsql { CREATE TABLE t6(a REFERENCES t4(a) NOT NULL); INSERT INTO t6 VALUES(NULL); } } {1 {t6.a may not be NULL}} do_test table-10.2 { catchsql { DROP TABLE t6; CREATE TABLE t6(a REFERENCES t4(a) MATCH PARTIAL); } } {0 {}} do_test table-10.3 { catchsql { DROP TABLE t6; CREATE TABLE t6(a REFERENCES t4 MATCH FULL ON DELETE SET NULL NOT NULL); } } {0 {}} do_test table-10.4 { catchsql { DROP TABLE t6; CREATE TABLE t6(a REFERENCES t4 MATCH FULL ON UPDATE SET DEFAULT DEFAULT 1); } } {0 {}} do_test table-10.5 { catchsql { DROP TABLE t6; CREATE TABLE t6(a NOT NULL NOT DEFERRABLE INITIALLY IMMEDIATE); } } {0 {}} do_test table-10.6 { catchsql { DROP TABLE t6; CREATE TABLE t6(a NOT NULL DEFERRABLE INITIALLY DEFERRED); } } {0 {}} do_test table-10.7 { catchsql { DROP TABLE t6; CREATE TABLE t6(a, FOREIGN KEY (a) REFERENCES t4(b) DEFERRABLE INITIALLY DEFERRED ); } } {0 {}} do_test table-10.8 { catchsql { DROP TABLE t6; CREATE TABLE t6(a,b,c, FOREIGN KEY (b,c) REFERENCES t4(x,y) MATCH PARTIAL ON UPDATE SET NULL ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); } } {0 {}} do_test table-10.9 { catchsql { DROP TABLE t6; CREATE TABLE t6(a,b,c, FOREIGN KEY (b,c) REFERENCES t4(x) ); } } {1 {number of columns in foreign key does not match the number of columns in the referenced table}} do_test table-10.10 { catchsql {DROP TABLE t6} catchsql { CREATE TABLE t6(a,b,c, FOREIGN KEY (b,c) REFERENCES t4(x,y,z) ); } } {1 {number of columns in foreign key does not match the number of columns in the referenced table}} do_test table-10.11 { catchsql {DROP TABLE t6} catchsql { CREATE TABLE t6(a,b, c REFERENCES t4(x,y)); } } {1 {foreign key on c should reference only one column of table t4}} do_test table-10.12 { catchsql {DROP TABLE t6} catchsql { CREATE TABLE t6(a,b,c, FOREIGN KEY (b,x) REFERENCES t4(x,y) ); } } {1 {unknown column "x" in foreign key definition}} do_test table-10.13 { catchsql {DROP TABLE t6} catchsql { CREATE TABLE t6(a,b,c, FOREIGN KEY (x,b) REFERENCES t4(x,y) ); } } {1 {unknown column "x" in foreign key definition}} # Test for the "typeof" function. # do_test table-11.1 { execsql { CREATE TABLE t7( a integer primary key, b number(5,10), c character varying (8), d VARCHAR(9), e clob, f BLOB, g Text, h ); INSERT INTO t7(a) VALUES(1); SELECT typeof(a), typeof(b), typeof(c), typeof(d), typeof(e), typeof(f), typeof(g), typeof(h) FROM t7 LIMIT 1; } } {numeric numeric text text text text text numeric} do_test table-11.2 { execsql { SELECT typeof(a+b), typeof(a||b), typeof(c+d), typeof(c||d) FROM t7 LIMIT 1; } } {numeric text numeric text} finish_test sqlite-2.8.17/test/misc3.test0000644000175000001440000001740110232547612015751 0ustar drhusers00000000000000# 2003 December 17 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # # $Id: misc3.test,v 1.10 2004/03/17 23:32:08 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Ticket #529. Make sure an ABORT does not damage the in-memory cache # that will be used by subsequent statements in the same transaction. # do_test misc3-1.1 { execsql { CREATE TABLE t1(a UNIQUE,b); INSERT INTO t1 VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_'); UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; INSERT INTO t1 VALUES(2,'x'); UPDATE t1 SET b=substr(b,1,500); BEGIN; } catchsql {UPDATE t1 SET a=CASE a WHEN 2 THEN 1 ELSE a END, b='y';} execsql { CREATE TABLE t2(x,y); COMMIT; PRAGMA integrity_check; } } ok do_test misc3-1.2 { execsql { DROP TABLE t1; DROP TABLE t2; VACUUM; CREATE TABLE t1(a UNIQUE,b); INSERT INTO t1 VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_'); INSERT INTO t1 SELECT a+1, b||b FROM t1; INSERT INTO t1 SELECT a+2, b||b FROM t1; INSERT INTO t1 SELECT a+4, b FROM t1; INSERT INTO t1 SELECT a+8, b FROM t1; INSERT INTO t1 SELECT a+16, b FROM t1; INSERT INTO t1 SELECT a+32, b FROM t1; INSERT INTO t1 SELECT a+64, b FROM t1; BEGIN; } catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';} execsql { INSERT INTO t1 VALUES(200,'hello out there'); COMMIT; PRAGMA integrity_check; } } ok # Tests of the sqliteAtoF() function in util.c # do_test misc3-2.1 { execsql {SELECT 2e-25*0.5e25} } 1 do_test misc3-2.2 { execsql {SELECT 2.0e-25*000000.500000000000000000000000000000e+00025} } 1 do_test misc3-2.3 { execsql {SELECT 000000000002e-0000000025*0.5e25} } 1 do_test misc3-2.4 { execsql {SELECT 2e-25*0.5e250} } 1e+225 do_test misc3-2.5 { execsql {SELECT 2.0e-250*0.5e25} } 1e-225 do_test misc3-2.6 { execsql {SELECT '-2.0e-127' * '-0.5e27'} } 1e-100 do_test misc3-2.7 { execsql {SELECT '+2.0e-127' * '-0.5e27'} } -1e-100 do_test misc3-2.8 { execsql {SELECT 2.0e-27 * '+0.5e+127'} } 1e+100 do_test misc3-2.9 { execsql {SELECT 2.0e-27 * '+0.000005e+132'} } 1e+100 # Ticket #522. Make sure integer overflow is handled properly in # indices. # do_test misc3-3.1 { execsql {PRAGMA integrity_check} } ok do_test misc3-3.2 { execsql { CREATE TABLE t2(a INT UNIQUE); PRAGMA integrity_check; } } ok do_test misc3-3.3 { execsql { INSERT INTO t2 VALUES(2147483648); PRAGMA integrity_check; } } ok do_test misc3-3.4 { execsql { INSERT INTO t2 VALUES(-2147483649); PRAGMA integrity_check; } } ok do_test misc3-3.5 { execsql { INSERT INTO t2 VALUES(+2147483649); PRAGMA integrity_check; } } ok do_test misc3-3.6 { execsql { INSERT INTO t2 VALUES(+2147483647); INSERT INTO t2 VALUES(-2147483648); INSERT INTO t2 VALUES(-2147483647); INSERT INTO t2 VALUES(2147483646); SELECT * FROM t2 ORDER BY a; } } {-2147483649 -2147483648 -2147483647 2147483646 2147483647 2147483648 2147483649} do_test misc3-3.7 { execsql { SELECT * FROM t2 WHERE a>=-2147483648 ORDER BY a; } } {-2147483648 -2147483647 2147483646 2147483647 2147483648 2147483649} do_test misc3-3.8 { execsql { SELECT * FROM t2 WHERE a>-2147483648 ORDER BY a; } } {-2147483647 2147483646 2147483647 2147483648 2147483649} do_test misc3-3.9 { execsql { SELECT * FROM t2 WHERE a>-2147483649 ORDER BY a; } } {-2147483648 -2147483647 2147483646 2147483647 2147483648 2147483649} do_test misc3-3.10 { execsql { SELECT * FROM t2 WHERE a>=0 AND a<2147483649 ORDER BY a DESC; } } {2147483648 2147483647 2147483646} do_test misc3-3.11 { execsql { SELECT * FROM t2 WHERE a>=0 AND a<=2147483648 ORDER BY a DESC; } } {2147483648 2147483647 2147483646} do_test misc3-3.12 { execsql { SELECT * FROM t2 WHERE a>=0 AND a<2147483648 ORDER BY a DESC; } } {2147483647 2147483646} do_test misc3-3.13 { execsql { SELECT * FROM t2 WHERE a>=0 AND a<=2147483647 ORDER BY a DESC; } } {2147483647 2147483646} do_test misc3-3.14 { execsql { SELECT * FROM t2 WHERE a>=0 AND a<2147483647 ORDER BY a DESC; } } {2147483646} # Ticket #565. A stack overflow is occurring when the subquery to the # right of an IN operator contains many NULLs # do_test misc3-4.1 { execsql { CREATE TABLE t3(a INTEGER PRIMARY KEY, b); INSERT INTO t3(b) VALUES('abc'); INSERT INTO t3(b) VALUES('xyz'); INSERT INTO t3(b) VALUES(NULL); INSERT INTO t3(b) VALUES(NULL); INSERT INTO t3(b) SELECT b||'d' FROM t3; INSERT INTO t3(b) SELECT b||'e' FROM t3; INSERT INTO t3(b) SELECT b||'f' FROM t3; INSERT INTO t3(b) SELECT b||'g' FROM t3; INSERT INTO t3(b) SELECT b||'h' FROM t3; SELECT count(a), count(b) FROM t3; } } {128 64} do_test misc3-4.2 { execsql { SELECT count(a) FROM t3 WHERE b IN (SELECT b FROM t3); } } {64} do_test misc3-4.3 { execsql { SELECT count(a) FROM t3 WHERE b IN (SELECT b FROM t3 ORDER BY a+1); } } {64} # Ticket #601: Putting a left join inside "SELECT * FROM ()" # gives different results that if the outer "SELECT * FROM ..." is omitted. # do_test misc3-5.1 { execsql { CREATE TABLE x1 (b, c); INSERT INTO x1 VALUES('dog',3); INSERT INTO x1 VALUES('cat',1); INSERT INTO x1 VALUES('dog',4); CREATE TABLE x2 (c, e); INSERT INTO x2 VALUES(1,'one'); INSERT INTO x2 VALUES(2,'two'); INSERT INTO x2 VALUES(3,'three'); INSERT INTO x2 VALUES(4,'four'); SELECT x2.c AS c, e, b FROM x2 LEFT JOIN (SELECT b, max(c) AS c FROM x1 GROUP BY b) USING(c); } } {1 one cat 2 two {} 3 three {} 4 four dog} do_test misc4-5.2 { execsql { SELECT * FROM ( SELECT x2.c AS c, e, b FROM x2 LEFT JOIN (SELECT b, max(c) AS c FROM x1 GROUP BY b) USING(c) ); } } {1 one cat 2 two {} 3 three {} 4 four dog} # Ticket #626: make sure EXPLAIN prevents BEGIN and COMMIT from working. # do_test misc3-6.1 { execsql {EXPLAIN BEGIN} catchsql {BEGIN} } {0 {}} do_test misc3-6.2 { execsql {EXPLAIN COMMIT} catchsql {COMMIT} } {0 {}} do_test misc3-6.3 { execsql {BEGIN; EXPLAIN ROLLBACK} catchsql {ROLLBACK} } {0 {}} # Ticket #640: vdbe stack overflow with a LIMIT clause on a SELECT inside # of a trigger. # do_test misc3-7.1 { execsql { BEGIN; CREATE TABLE y1(a); CREATE TABLE y2(b); CREATE TABLE y3(c); CREATE TRIGGER r1 AFTER DELETE ON y1 FOR EACH ROW BEGIN INSERT INTO y3(c) SELECT b FROM y2 ORDER BY b LIMIT 1; END; INSERT INTO y1 VALUES(1); INSERT INTO y1 VALUES(2); INSERT INTO y1 SELECT a+2 FROM y1; INSERT INTO y1 SELECT a+4 FROM y1; INSERT INTO y1 SELECT a+8 FROM y1; INSERT INTO y1 SELECT a+16 FROM y1; INSERT INTO y2 SELECT a FROM y1; COMMIT; SELECT count(*) FROM y1; } } 32 do_test misc3-7.2 { execsql { DELETE FROM y1; SELECT count(*) FROM y1; } } 0 do_test misc3-7.3 { execsql { SELECT count(*) FROM y3; } } 32 # Ticket #668: VDBE stack overflow occurs when the left-hand side # of an IN expression is NULL and the result is used as an integer, not # as a jump. # do_test misc-8.1 { execsql { SELECT count(CASE WHEN b IN ('abc','xyz') THEN 'x' END) FROM t3 } } {2} do_test misc-8.2 { execsql { SELECT count(*) FROM t3 WHERE 1+(b IN ('abc','xyz'))==2 } } {2} finish_test sqlite-2.8.17/test/view.test0000644000175000001440000002067610232547612015715 0ustar drhusers00000000000000# 2002 February 26 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # # $Id: view.test,v 1.16.2.1 2004/07/20 00:20:47 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test view-1.0 { execsql { CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(4,5,6); INSERT INTO t1 VALUES(7,8,9); SELECT * FROM t1; } } {1 2 3 4 5 6 7 8 9} do_test view-1.1 { execsql { BEGIN; CREATE VIEW v1 AS SELECT a,b FROM t1; SELECT * FROM v1 ORDER BY a; } } {1 2 4 5 7 8} do_test view-1.2 { catchsql { ROLLBACK; SELECT * FROM v1 ORDER BY a; } } {1 {no such table: v1}} do_test view-1.3 { execsql { CREATE VIEW v1 AS SELECT a,b FROM t1; SELECT * FROM v1 ORDER BY a; } } {1 2 4 5 7 8} do_test view-1.3.1 { db close sqlite db test.db execsql { SELECT * FROM v1 ORDER BY a; } } {1 2 4 5 7 8} do_test view-1.4 { catchsql { DROP VIEW v1; SELECT * FROM v1 ORDER BY a; } } {1 {no such table: v1}} do_test view-1.5 { execsql { CREATE VIEW v1 AS SELECT a,b FROM t1; SELECT * FROM v1 ORDER BY a; } } {1 2 4 5 7 8} do_test view-1.6 { catchsql { DROP TABLE t1; SELECT * FROM v1 ORDER BY a; } } {1 {no such table: main.t1}} do_test view-1.7 { execsql { CREATE TABLE t1(x,a,b,c); INSERT INTO t1 VALUES(1,2,3,4); INSERT INTO t1 VALUES(4,5,6,7); INSERT INTO t1 VALUES(7,8,9,10); SELECT * FROM v1 ORDER BY a; } } {2 3 5 6 8 9} do_test view-1.8 { db close sqlite db test.db execsql { SELECT * FROM v1 ORDER BY a; } } {2 3 5 6 8 9} do_test view-2.1 { execsql { CREATE VIEW v2 AS SELECT * FROM t1 WHERE a>5 }; # No semicolon execsql2 { SELECT * FROM v2; } } {x 7 a 8 b 9 c 10} do_test view-2.2 { catchsql { INSERT INTO v2 VALUES(1,2,3,4); } } {1 {cannot modify v2 because it is a view}} do_test view-2.3 { catchsql { UPDATE v2 SET a=10 WHERE a=5; } } {1 {cannot modify v2 because it is a view}} do_test view-2.4 { catchsql { DELETE FROM v2; } } {1 {cannot modify v2 because it is a view}} do_test view-2.5 { execsql { INSERT INTO t1 VALUES(11,12,13,14); SELECT * FROM v2 ORDER BY x; } } {7 8 9 10 11 12 13 14} do_test view-2.6 { execsql { SELECT x FROM v2 WHERE a>10 } } {11} # Test that column name of views are generated correctly. # do_test view-3.1 { execsql2 { SELECT * FROM v1 LIMIT 1 } } {a 2 b 3} do_test view-3.2 { execsql2 { SELECT * FROM v2 LIMIT 1 } } {x 7 a 8 b 9 c 10} do_test view-3.3 { execsql2 { DROP VIEW v1; CREATE VIEW v1 AS SELECT a AS 'xyz', b+c AS 'pqr', c-b FROM t1; SELECT * FROM v1 LIMIT 1 } } {xyz 2 pqr 7 c-b 1} do_test view-3.4 { execsql2 { CREATE VIEW v3 AS SELECT a FROM t1 UNION SELECT b FROM t1 ORDER BY b; SELECT * FROM v3 LIMIT 4; } } {b 2 b 3 b 5 b 6} do_test view-3.5 { execsql2 { CREATE VIEW v4 AS SELECT a, b FROM t1 UNION SELECT b AS 'x', a AS 'y' FROM t1 ORDER BY x, y; SELECT y FROM v4 ORDER BY y LIMIT 4; } } {y 2 y 3 y 5 y 6} do_test view-4.1 { catchsql { DROP VIEW t1; } } {1 {use DROP TABLE to delete table t1}} do_test view-4.2 { execsql { SELECT 1 FROM t1 LIMIT 1; } } 1 do_test view-4.3 { catchsql { DROP TABLE v1; } } {1 {use DROP VIEW to delete view v1}} do_test view-4.4 { execsql { SELECT 1 FROM v1 LIMIT 1; } } {1} do_test view-4.5 { catchsql { CREATE INDEX i1v1 ON v1(xyz); } } {1 {views may not be indexed}} do_test view-5.1 { execsql { CREATE TABLE t2(y,a); INSERT INTO t2 VALUES(22,2); INSERT INTO t2 VALUES(33,3); INSERT INTO t2 VALUES(44,4); INSERT INTO t2 VALUES(55,5); SELECT * FROM t2; } } {22 2 33 3 44 4 55 5} do_test view-5.2 { execsql { CREATE VIEW v5 AS SELECT t1.x AS v, t2.y AS w FROM t1 JOIN t2 USING(a); SELECT * FROM v5; } } {1 22 4 55} # Verify that the view v5 gets flattened. see sqliteFlattenSubquery(). # Ticket #272 do_test view-5.3 { lsearch [execsql { EXPLAIN SELECT * FROM v5; }] OpenTemp } {-1} do_test view-5.4 { execsql { SELECT * FROM v5 AS a, t2 AS b WHERE a.w=b.y; } } {1 22 22 2 4 55 55 5} do_test view-5.5 { lsearch [execsql { EXPLAIN SELECT * FROM v5 AS a, t2 AS b WHERE a.w=b.y; }] OpenTemp } {-1} do_test view-5.6 { execsql { SELECT * FROM t2 AS b, v5 AS a WHERE a.w=b.y; } } {22 2 1 22 55 5 4 55} do_test view-5.7 { lsearch [execsql { EXPLAIN SELECT * FROM t2 AS b, v5 AS a WHERE a.w=b.y; }] OpenTemp } {-1} do_test view-5.8 { execsql { SELECT * FROM t1 AS a, v5 AS b, t2 AS c WHERE a.x=b.v AND b.w=c.y; } } {1 2 3 4 1 22 22 2 4 5 6 7 4 55 55 5} do_test view-5.9 { lsearch [execsql { EXPLAIN SELECT * FROM t1 AS a, v5 AS b, t2 AS c WHERE a.x=b.v AND b.w=c.y; }] OpenTemp } {-1} do_test view-6.1 { execsql { SELECT min(x), min(a), min(b), min(c), min(a+b+c) FROM v2; } } {7 8 9 10 27} do_test view-6.2 { execsql { SELECT max(x), max(a), max(b), max(c), max(a+b+c) FROM v2; } } {11 12 13 14 39} do_test view-7.1 { execsql { CREATE TABLE test1(id integer primary key, a); CREATE TABLE test2(id integer, b); INSERT INTO test1 VALUES(1,2); INSERT INTO test2 VALUES(1,3); CREATE VIEW test AS SELECT test1.id, a, b FROM test1 JOIN test2 ON test2.id=test1.id; SELECT * FROM test; } } {1 2 3} do_test view-7.2 { db close sqlite db test.db execsql { SELECT * FROM test; } } {1 2 3} do_test view-7.3 { execsql { DROP VIEW test; CREATE VIEW test AS SELECT test1.id, a, b FROM test1 JOIN test2 USING(id); SELECT * FROM test; } } {1 2 3} do_test view-7.4 { db close sqlite db test.db execsql { SELECT * FROM test; } } {1 2 3} do_test view-7.5 { execsql { DROP VIEW test; CREATE VIEW test AS SELECT test1.id, a, b FROM test1 NATURAL JOIN test2; SELECT * FROM test; } } {1 2 3} do_test view-7.6 { db close sqlite db test.db execsql { SELECT * FROM test; } } {1 2 3} do_test view-8.1 { execsql { CREATE VIEW v6 AS SELECT pqr, xyz FROM v1; SELECT * FROM v6 ORDER BY xyz; } } {7 2 13 5 19 8 27 12} do_test view-8.2 { db close sqlite db test.db execsql { SELECT * FROM v6 ORDER BY xyz; } } {7 2 13 5 19 8 27 12} do_test view-8.3 { execsql { CREATE VIEW v7 AS SELECT pqr+xyz AS a FROM v6; SELECT * FROM v7 ORDER BY a; } } {9 18 27 39} do_test view-8.4 { execsql { CREATE VIEW v8 AS SELECT max(cnt) AS mx FROM (SELECT a%2 AS eo, count(*) AS cnt FROM t1 GROUP BY eo); SELECT * FROM v8; } } 3 do_test view-8.5 { execsql { SELECT mx+10, mx*2 FROM v8; } } {13 6} do_test view-8.6 { execsql { SELECT mx+10, pqr FROM v6, v8 WHERE xyz=2; } } {13 7} do_test view-8.7 { execsql { SELECT mx+10, pqr FROM v6, v8 WHERE xyz>2; } } {13 13 13 19 13 27} # Tests for a bug found by Michiel de Wit involving ORDER BY in a VIEW. # do_test view-9.1 { execsql { INSERT INTO t2 SELECT * FROM t2 WHERE a<5; INSERT INTO t2 SELECT * FROM t2 WHERE a<4; INSERT INTO t2 SELECT * FROM t2 WHERE a<3; SELECT DISTINCT count(*) FROM t2 GROUP BY a ORDER BY 1; } } {1 2 4 8} do_test view-9.2 { execsql { SELECT DISTINCT count(*) FROM t2 GROUP BY a ORDER BY 1 LIMIT 3; } } {1 2 4} do_test view-9.3 { execsql { CREATE VIEW v9 AS SELECT DISTINCT count(*) FROM t2 GROUP BY a ORDER BY 1 LIMIT 3; SELECT * FROM v9; } } {1 2 4} do_test view-9.4 { execsql { SELECT * FROM v9 ORDER BY 1 DESC; } } {4 2 1} do_test view-9.5 { execsql { CREATE VIEW v10 AS SELECT DISTINCT a, count(*) FROM t2 GROUP BY a ORDER BY 2 LIMIT 3; SELECT * FROM v10; } } {5 1 4 2 3 4} do_test view-9.6 { execsql { SELECT * FROM v10 ORDER BY 1; } } {3 4 4 2 5 1} # Tables with columns having peculiar quoted names used in views # Ticket #756. # do_test view-10.1 { execsql { CREATE TABLE t3("9" integer, [4] text); INSERT INTO t3 VALUES(1,2); CREATE VIEW v_t3_a AS SELECT a.[9] FROM t3 AS a; CREATE VIEW v_t3_b AS SELECT "4" FROM t3; SELECT * FROM v_t3_a; } } {1} do_test view-10.2 { execsql { SELECT * FROM v_t3_b; } } {2} finish_test sqlite-2.8.17/test/printf.test0000644000175000001440000001074710232547612016243 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the sqlite_*_printf() interface. # # $Id: printf.test,v 1.8 2004/02/21 19:41:05 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set n 1 foreach v {1 2 5 10 99 100 1000000 999999999 0 -1 -2 -5 -10 -99 -100 -9999999} { do_test printf-1.$n.1 [subst { sqlite_mprintf_int {Three integers: %d %x %o} $v $v $v }] [format {Three integers: %d %x %o} $v $v $v] do_test printf-1.$n.2 [subst { sqlite_mprintf_int {Three integers: (%6d) (%6x) (%6o)} $v $v $v }] [format {Three integers: (%6d) (%6x) (%6o)} $v $v $v] do_test printf-1.$n.3 [subst { sqlite_mprintf_int {Three integers: (%-6d) (%-6x) (%-6o)} $v $v $v }] [format {Three integers: (%-6d) (%-6x) (%-6o)} $v $v $v] do_test printf-1.$n.4 [subst { sqlite_mprintf_int {Three integers: (%+6d) (%+6x) (%+6o)} $v $v $v }] [format {Three integers: (%+6d) (%+6x) (%+6o)} $v $v $v] do_test printf-1.$n.5 [subst { sqlite_mprintf_int {Three integers: (%06d) (%06x) (%06o)} $v $v $v }] [format {Three integers: (%06d) (%06x) (%06o)} $v $v $v] do_test printf-1.$n.6 [subst { sqlite_mprintf_int {Three integers: (% 6d) (% 6x) (% 6o)} $v $v $v }] [format {Three integers: (% 6d) (% 6x) (% 6o)} $v $v $v] incr n } if {$::tcl_platform(platform)!="windows"} { set m 1 foreach {a b} {1 1 5 5 10 10 10 5} { set n 1 foreach x {0.001 1.0e-20 1.0 0.0 100.0 9.99999 -0.00543 -1.0 -99.99999} { do_test printf-2.$m.$n.1 [subst { sqlite_mprintf_double {A double: %*.*f} $a $b $x }] [format {A double: %*.*f} $a $b $x] do_test printf-2.$m.$n.2 [subst { sqlite_mprintf_double {A double: %*.*e} $a $b $x }] [format {A double: %*.*e} $a $b $x] do_test printf-2.$m.$n.3 [subst { sqlite_mprintf_double {A double: %*.*g} $a $b $x }] [format {A double: %*.*g} $a $b $x] do_test printf-2.$m.$n.4 [subst { sqlite_mprintf_double {A double: %d %d %g} $a $b $x }] [format {A double: %d %d %g} $a $b $x] do_test printf-2.$m.$n.5 [subst { sqlite_mprintf_double {A double: %d %d %#g} $a $b $x }] [format {A double: %d %d %#g} $a $b $x] incr n } incr m } } do_test printf-3.1 { sqlite_mprintf_str {A String: (%*.*s)} 10 10 {This is the string} } [format {A String: (%*.*s)} 10 10 {This is the string}] do_test printf-3.2 { sqlite_mprintf_str {A String: (%*.*s)} 10 5 {This is the string} } [format {A String: (%*.*s)} 10 5 {This is the string}] do_test printf-3.3 { sqlite_mprintf_str {A String: (%*.*s)} -10 5 {This is the string} } [format {A String: (%*.*s)} -10 5 {This is the string}] do_test printf-3.4 { sqlite_mprintf_str {%d %d A String: (%s)} 1 2 {This is the string} } [format {%d %d A String: (%s)} 1 2 {This is the string}] do_test printf-3.5 { sqlite_mprintf_str {%d %d A String: (%30s)} 1 2 {This is the string} } [format {%d %d A String: (%30s)} 1 2 {This is the string}] do_test printf-3.6 { sqlite_mprintf_str {%d %d A String: (%-30s)} 1 2 {This is the string} } [format {%d %d A String: (%-30s)} 1 2 {This is the string}] do_test printf-4.1 { sqlite_mprintf_str {%d %d A quoted string: '%q'} 1 2 {Hi Y'all} } {1 2 A quoted string: 'Hi Y''all'} do_test printf-4.2 { sqlite_mprintf_str {%d %d A NULL pointer in %%q: '%q'} 1 2 } {1 2 A NULL pointer in %q: '(NULL)'} do_test printf-4.3 { sqlite_mprintf_str {%d %d A quoted string: %Q} 1 2 {Hi Y'all} } {1 2 A quoted string: 'Hi Y''all'} do_test printf-4.4 { sqlite_mprintf_str {%d %d A NULL pointer in %%Q: %Q} 1 2 } {1 2 A NULL pointer in %Q: NULL} do_test printf-5.1 { set x [sqlite_mprintf_str {%d %d %100000s} 0 0 {Hello}] string length $x } {994} do_test printf-5.2 { sqlite_mprintf_str {%d %d (%-10.10s) %} -9 -10 {HelloHelloHello} } {-9 -10 (HelloHello) %} do_test printf-6.1 { sqlite_mprintf_z_test , one two three four five six } {,one,two,three,four,five,six} do_test printf-7.1 { sqlite_mprintf_scaled {A double: %g} 1.0e307 1.0 } {A double: 1e+307} do_test printf-7.2 { sqlite_mprintf_scaled {A double: %g} 1.0e307 10.0 } {A double: 1e+308} do_test printf-7.3 { sqlite_mprintf_scaled {A double: %g} 1.0e307 100.0 } {A double: NaN} finish_test sqlite-2.8.17/test/subselect.test0000644000175000001440000000752710232547612016734 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that are part of # expressions. # # $Id: subselect.test,v 1.7 2002/07/15 18:55:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Basic sanity checking. Try a simple subselect. # do_test subselect-1.1 { execsql { CREATE TABLE t1(a int, b int); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); INSERT INTO t1 VALUES(5,6); } execsql {SELECT * FROM t1 WHERE a = (SELECT count(*) FROM t1)} } {3 4} # Try a select with more than one result column. # do_test subselect-1.2 { set v [catch {execsql {SELECT * FROM t1 WHERE a = (SELECT * FROM t1)}} msg] lappend v $msg } {1 {only a single result allowed for a SELECT that is part of an expression}} # A subselect without an aggregate. # do_test subselect-1.3a { execsql {SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=2)} } {2} do_test subselect-1.3b { execsql {SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=4)} } {4} do_test subselect-1.3c { execsql {SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=6)} } {6} do_test subselect-1.3c { execsql {SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=8)} } {} # What if the subselect doesn't return any value. We should get # NULL as the result. Check it out. # do_test subselect-1.4 { execsql {SELECT b from t1 where a = coalesce((SELECT a FROM t1 WHERE b=5),1)} } {2} # Try multiple subselects within a single expression. # do_test subselect-1.5 { execsql { CREATE TABLE t2(x int, y int); INSERT INTO t2 VALUES(1,2); INSERT INTO t2 VALUES(2,4); INSERT INTO t2 VALUES(3,8); INSERT INTO t2 VALUES(4,16); } execsql { SELECT y from t2 WHERE x = (SELECT sum(b) FROM t1 where a notnull) - (SELECT sum(a) FROM t1) } } {8} # Try something useful. Delete every entry from t2 where the # x value is less than half of the maximum. # do_test subselect-1.6 { execsql {DELETE FROM t2 WHERE x < 0.5*(SELECT max(x) FROM t2)} execsql {SELECT x FROM t2 ORDER BY x} } {2 3 4} # Make sure sorting works for SELECTs there used as a scalar expression. # do_test subselect-2.1 { execsql { SELECT (SELECT a FROM t1 ORDER BY a), (SELECT a FROM t1 ORDER BY a DESC) } } {1 5} do_test subselect-2.2 { execsql { SELECT 1 IN (SELECT a FROM t1 ORDER BY a); } } {1} do_test subselect-2.3 { execsql { SELECT 2 IN (SELECT a FROM t1 ORDER BY a DESC); } } {0} # Verify that the ORDER BY clause is honored in a subquery. # do_test subselect-3.1 { execsql { CREATE TABLE t3(x int); INSERT INTO t3 SELECT a FROM t1 UNION ALL SELECT b FROM t1; SELECT * FROM t3 ORDER BY x; } } {1 2 3 4 5 6} do_test subselect-3.2 { execsql { SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x LIMIT 2); } } {3} do_test subselect-3.3 { execsql { SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x DESC LIMIT 2); } } {11} do_test subselect-3.4 { execsql { SELECT (SELECT x FROM t3 ORDER BY x); } } {1} do_test subselect-3.5 { execsql { SELECT (SELECT x FROM t3 ORDER BY x DESC); } } {6} do_test subselect-3.6 { execsql { SELECT (SELECT x FROM t3 ORDER BY x LIMIT 1); } } {1} do_test subselect-3.7 { execsql { SELECT (SELECT x FROM t3 ORDER BY x DESC LIMIT 1); } } {6} do_test subselect-3.8 { execsql { SELECT (SELECT x FROM t3 ORDER BY x LIMIT 1 OFFSET 2); } } {3} do_test subselect-3.9 { execsql { SELECT (SELECT x FROM t3 ORDER BY x DESC LIMIT 1 OFFSET 2); } } {4} finish_test sqlite-2.8.17/test/capi2.test0000644000175000001440000003141510232547612015732 0ustar drhusers00000000000000# 2003 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # # $Id: capi2.test,v 1.10 2003/08/05 13:13:38 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Check basic functionality # do_test capi2-1.1 { db close set DB [sqlite db test.db] execsql {CREATE TABLE t1(a,b,c)} set VM [sqlite_compile $DB {SELECT name, rowid FROM sqlite_master} TAIL] set TAIL } {} do_test capi2-1.2 { sqlite_step $VM N VALUES COLNAMES } {SQLITE_ROW} do_test capi2-1.3 { set N } {2} do_test capi2-1.4 { set VALUES } {t1 1} do_test capi2-1.5 { set COLNAMES } {name rowid text INTEGER} do_test capi2-1.6 { set N x set VALUES y set COLNAMES z sqlite_step $VM N VALUES COLNAMES } {SQLITE_DONE} do_test capi2-1.7 { list $N $VALUES $COLNAMES } {2 {} {name rowid text INTEGER}} do_test capi2-1.8 { set N x set VALUES y set COLNAMES z sqlite_step $VM N VALUES COLNAMES } {SQLITE_MISUSE} do_test capi2-1.9 { list $N $VALUES $COLNAMES } {0 {} {}} do_test capi2-1.10 { sqlite_finalize $VM } {} # Check to make sure that the "tail" of a multi-statement SQL script # is returned by sqlite_compile. # do_test capi2-2.1 { set SQL { SELECT name, rowid FROM sqlite_master; SELECT name, rowid FROM sqlite_temp_master; -- A comment at the end } set VM [sqlite_compile $DB $SQL SQL] set SQL } { SELECT name, rowid FROM sqlite_temp_master; -- A comment at the end } do_test capi2-2.2 { set r [sqlite_step $VM n val colname] lappend r $n $val $colname } {SQLITE_ROW 2 {t1 1} {name rowid text INTEGER}} do_test capi2-2.3 { set r [sqlite_step $VM n val colname] lappend r $n $val $colname } {SQLITE_DONE 2 {} {name rowid text INTEGER}} do_test capi2-2.4 { sqlite_finalize $VM } {} do_test capi2-2.5 { set VM [sqlite_compile $DB $SQL SQL] set SQL } { -- A comment at the end } do_test capi2-2.6 { set r [sqlite_step $VM n val colname] lappend r $n $val $colname } {SQLITE_DONE 2 {} {name rowid text INTEGER}} do_test capi2-2.7 { sqlite_finalize $VM } {} do_test capi2-2.8 { set VM [sqlite_compile $DB $SQL SQL] list $SQL $VM } {{} {}} # Check the error handling. # do_test capi2-3.1 { set rc [catch { sqlite_compile $DB {select bogus from sqlite_master} TAIL } msg] lappend rc $msg $TAIL } {1 {(1) no such column: bogus} {}} do_test capi2-3.2 { set rc [catch { sqlite_compile $DB {select bogus from } TAIL } msg] lappend rc $msg $TAIL } {1 {(1) near " ": syntax error} {}} do_test capi2-3.3 { set rc [catch { sqlite_compile $DB {;;;;select bogus from sqlite_master} TAIL } msg] lappend rc $msg $TAIL } {1 {(1) no such column: bogus} {}} do_test capi2-3.4 { set rc [catch { sqlite_compile $DB {select bogus from sqlite_master;x;} TAIL } msg] lappend rc $msg $TAIL } {1 {(1) no such column: bogus} {x;}} do_test capi2-3.5 { set rc [catch { sqlite_compile $DB {select bogus from sqlite_master;;;x;} TAIL } msg] lappend rc $msg $TAIL } {1 {(1) no such column: bogus} {;;x;}} do_test capi2-3.6 { set rc [catch { sqlite_compile $DB {select 5/0} TAIL } VM] lappend rc $TAIL } {0 {}} do_test capi2-3.7 { set N {} set VALUE {} set COLNAME {} list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 {{}} {5/0 NUMERIC}} do_test capi2-3.8 { sqlite_finalize $VM } {} do_test capi2-3.9 { execsql {CREATE UNIQUE INDEX i1 ON t1(a)} set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,2,3)} TAIL] set TAIL } {} do_test capi2-3.9b {db changes} {0} do_test capi2-3.10 { set N {} set VALUE {} set COLNAME {} list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_DONE 0 {} {}} do_test capi2-3.10b {db changes} {1} do_test capi2-3.11 { sqlite_finalize $VM } {} do_test capi2-3.11b {db changes} {1} do_test capi2-3.12 { list [catch {sqlite_finalize $VM} msg] [set msg] } {1 {(21) library routine called out of sequence}} do_test capi2-3.13 { set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,3,4)} TAIL] list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ERROR 0 {} {}} do_test capi2-3.13b {db changes} {0} do_test capi2-3.14 { list [catch {sqlite_finalize $VM} msg] [set msg] } {1 {(19) column a is not unique}} do_test capi2-3.15 { set VM [sqlite_compile $DB {CREATE TABLE t2(a NOT NULL, b)} TAIL] set TAIL } {} do_test capi2-3.16 { list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_DONE 0 {} {}} do_test capi2-3.17 { list [catch {sqlite_finalize $VM} msg] [set msg] } {0 {}} do_test capi2-3.18 { set VM [sqlite_compile $DB {INSERT INTO t2 VALUES(NULL,2)} TAIL] list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ERROR 0 {} {}} do_test capi2-3.19 { list [catch {sqlite_finalize $VM} msg] [set msg] } {1 {(19) t2.a may not be NULL}} # Two or more virtual machines exists at the same time. # do_test capi2-4.1 { set VM1 [sqlite_compile $DB {INSERT INTO t2 VALUES(1,2)} TAIL] set TAIL } {} do_test capi2-4.2 { set VM2 [sqlite_compile $DB {INSERT INTO t2 VALUES(2,3)} TAIL] set TAIL } {} do_test capi2-4.3 { set VM3 [sqlite_compile $DB {INSERT INTO t2 VALUES(3,4)} TAIL] set TAIL } {} do_test capi2-4.4 { list [sqlite_step $VM2 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_DONE 0 {} {}} do_test capi2-4.5 { execsql {SELECT * FROM t2 ORDER BY a} } {2 3} do_test capi2-4.6 { list [catch {sqlite_finalize $VM2} msg] [set msg] } {0 {}} do_test capi2-4.7 { list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_DONE 0 {} {}} do_test capi2-4.8 { execsql {SELECT * FROM t2 ORDER BY a} } {2 3 3 4} do_test capi2-4.9 { list [catch {sqlite_finalize $VM3} msg] [set msg] } {0 {}} do_test capi2-4.10 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_DONE 0 {} {}} do_test capi2-4.11 { execsql {SELECT * FROM t2 ORDER BY a} } {1 2 2 3 3 4} do_test capi2-4.12 { list [catch {sqlite_finalize $VM1} msg] [set msg] } {0 {}} # Interleaved SELECTs # do_test capi2-5.1 { set VM1 [sqlite_compile $DB {SELECT * FROM t2} TAIL] set VM2 [sqlite_compile $DB {SELECT * FROM t2} TAIL] set VM3 [sqlite_compile $DB {SELECT * FROM t2} TAIL] list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {2 3} {a b {} {}}} do_test capi2-5.2 { list [sqlite_step $VM2 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {2 3} {a b {} {}}} do_test capi2-5.3 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {3 4} {a b {} {}}} do_test capi2-5.4 { list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {2 3} {a b {} {}}} do_test capi2-5.5 { list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {3 4} {a b {} {}}} do_test capi2-5.6 { list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {1 2} {a b {} {}}} do_test capi2-5.7 { list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_DONE 2 {} {a b {} {}}} do_test capi2-5.8 { list [catch {sqlite_finalize $VM3} msg] [set msg] } {0 {}} do_test capi2-5.9 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {1 2} {a b {} {}}} do_test capi2-5.10 { list [catch {sqlite_finalize $VM1} msg] [set msg] } {0 {}} do_test capi2-5.11 { list [sqlite_step $VM2 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {3 4} {a b {} {}}} do_test capi2-5.12 { list [sqlite_step $VM2 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 2 {1 2} {a b {} {}}} do_test capi2-5.11 { list [catch {sqlite_finalize $VM2} msg] [set msg] } {0 {}} # Check for proper SQLITE_BUSY returns. # do_test capi2-6.1 { execsql { BEGIN; CREATE TABLE t3(x counter); INSERT INTO t3 VALUES(1); INSERT INTO t3 VALUES(2); INSERT INTO t3 SELECT x+2 FROM t3; INSERT INTO t3 SELECT x+4 FROM t3; INSERT INTO t3 SELECT x+8 FROM t3; COMMIT; } set VM1 [sqlite_compile $DB {SELECT * FROM t3} TAIL] sqlite db2 test.db execsql {BEGIN} db2 } {} do_test capi2-6.2 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_BUSY 0 {} {}} do_test capi2-6.3 { execsql {COMMIT} db2 } {} do_test capi2-6.4 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 1 {x counter}} do_test capi2-6.5 { catchsql {BEGIN} db2 } {1 {database is locked}} do_test capi2-6.6 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 2 {x counter}} do_test capi2-6.7 { execsql {SELECT * FROM t2} db2 } {2 3 3 4 1 2} do_test capi2-6.8 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 3 {x counter}} do_test capi2-6.9 { execsql {SELECT * FROM t2} } {2 3 3 4 1 2} do_test capi2-6.10 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 4 {x counter}} do_test capi2-6.11 { execsql {BEGIN} } {} do_test capi2-6.12 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 5 {x counter}} # execsql {pragma vdbe_trace=on} do_test capi2-6.13 { catchsql {UPDATE t3 SET x=x+1} } {1 {database table is locked}} do_test capi2-6.14 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 6 {x counter}} # puts [list [catch {sqlite_finalize $VM1} msg] [set msg]]; exit do_test capi2-6.15 { execsql {SELECT * FROM t1} } {1 2 3} do_test capi2-6.16 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 7 {x counter}} do_test capi2-6.17 { catchsql {UPDATE t1 SET b=b+1} } {0 {}} do_test capi2-6.18 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 8 {x counter}} do_test capi2-6.19 { execsql {SELECT * FROM t1} } {1 3 3} do_test capi2-6.20 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 9 {x counter}} do_test capi2-6.21 { execsql {ROLLBACK; SELECT * FROM t1} } {1 2 3} do_test capi2-6.22 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 10 {x counter}} do_test capi2-6.23 { execsql {BEGIN TRANSACTION ON CONFLICT ROLLBACK;} } {} do_test capi2-6.24 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 11 {x counter}} do_test capi2-6.25 { execsql { INSERT INTO t1 VALUES(2,3,4); SELECT * FROM t1; } } {1 2 3 2 3 4} do_test capi2-6.26 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 12 {x counter}} do_test capi2-6.27 { catchsql { INSERT INTO t1 VALUES(2,4,5); SELECT * FROM t1; } } {1 {column a is not unique}} do_test capi2-6.28 { list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME] } {SQLITE_ROW 1 13 {x counter}} do_test capi2-6.99 { list [catch {sqlite_finalize $VM1} msg] [set msg] } {0 {}} catchsql {ROLLBACK} do_test capi2-7.1 { stepsql $DB { SELECT * FROM t1 } } {0 1 2 3} do_test capi2-7.2 { stepsql $DB { PRAGMA count_changes=on } } {0} do_test capi2-7.3 { stepsql $DB { UPDATE t1 SET a=a+10; } } {0 1} do_test capi2-7.4 { stepsql $DB { INSERT INTO t1 SELECT a+1,b+1,c+1 FROM t1; } } {0 1} do_test capi2-7.4b {db changes} {1} do_test capi2-7.5 { stepsql $DB { UPDATE t1 SET a=a+10; } } {0 2} do_test capi2-7.5b {db changes} {2} do_test capi2-7.6 { stepsql $DB { SELECT * FROM t1; } } {0 21 2 3 22 3 4} do_test capi2-7.7 { stepsql $DB { INSERT INTO t1 SELECT a+2,b+2,c+2 FROM t1; } } {0 2} do_test capi2-7.8 { db changes } {2} do_test capi2-7.9 { stepsql $DB { SELECT * FROM t1; } } {0 21 2 3 22 3 4 23 4 5 24 5 6} do_test capi2-7.10 { stepsql $DB { UPDATE t1 SET a=a-20; SELECT * FROM t1; } } {0 4 1 2 3 2 3 4 3 4 5 4 5 6} do_test capi2-7.11 { db changes } {0} do_test capi2-7.12 { set x [stepsql $DB {EXPLAIN SELECT * FROM t1}] lindex $x 0 } {0} # Ticket #261 - make sure we can finalize before the end of a query. # do_test capi2-8.1 { set VM1 [sqlite_compile $DB {SELECT * FROM t2} TAIL] sqlite_finalize $VM1 } {} # Tickets #384 and #385 - make sure the TAIL argument to sqlite_compile # and all of the return pointers in sqlite_step can be null. # do_test capi2-9.1 { set VM1 [sqlite_compile $DB {SELECT * FROM t2}] sqlite_step $VM1 sqlite_finalize $VM1 } {} db2 close finish_test sqlite-2.8.17/test/insert2.test0000644000175000001440000001107210232547612016317 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT statement that takes is # result from a SELECT. # # $Id: insert2.test,v 1.10 2002/06/25 13:16:04 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create some tables with data that we can select against # do_test insert2-1.0 { execsql {CREATE TABLE d1(n int, log int);} for {set i 1} {$i<=20} {incr i} { for {set j 0} {pow(2,$j)<$i} {incr j} {} execsql "INSERT INTO d1 VALUES($i,$j)" } execsql {SELECT * FROM d1 ORDER BY n} } {1 0 2 1 3 2 4 2 5 3 6 3 7 3 8 3 9 4 10 4 11 4 12 4 13 4 14 4 15 4 16 4 17 5 18 5 19 5 20 5} # Insert into a new table from the old one. # do_test insert2-1.1.1 { execsql { CREATE TABLE t1(log int, cnt int); PRAGMA count_changes=on; INSERT INTO t1 SELECT log, count(*) FROM d1 GROUP BY log; } } {6} do_test insert2-1.1.2 { db changes } {6} do_test insert2-1.1.3 { execsql {SELECT * FROM t1 ORDER BY log} } {0 1 1 1 2 2 3 4 4 8 5 4} do_test insert2-1.2.1 { catch {execsql {DROP TABLE t1}} execsql { CREATE TABLE t1(log int, cnt int); INSERT INTO t1 SELECT log, count(*) FROM d1 GROUP BY log EXCEPT SELECT n-1,log FROM d1; } } {4} do_test insert2-1.2.2 { execsql { SELECT * FROM t1 ORDER BY log; } } {0 1 3 4 4 8 5 4} do_test insert2-1.3.1 { catch {execsql {DROP TABLE t1}} execsql { CREATE TABLE t1(log int, cnt int); PRAGMA count_changes=off; INSERT INTO t1 SELECT log, count(*) FROM d1 GROUP BY log INTERSECT SELECT n-1,log FROM d1; } } {} do_test insert2-1.3.2 { execsql { SELECT * FROM t1 ORDER BY log; } } {1 1 2 2} do_test insert2-1.4 { catch {execsql {DROP TABLE t1}} set r [execsql { CREATE TABLE t1(log int, cnt int); CREATE INDEX i1 ON t1(log); CREATE INDEX i2 ON t1(cnt); INSERT INTO t1 SELECT log, count() FROM d1 GROUP BY log; SELECT * FROM t1 ORDER BY log; }] lappend r [execsql {SELECT cnt FROM t1 WHERE log=3}] lappend r [execsql {SELECT log FROM t1 WHERE cnt=4 ORDER BY log}] } {0 1 1 1 2 2 3 4 4 8 5 4 4 {3 5}} do_test insert2-2.0 { execsql { CREATE TABLE t3(a,b,c); CREATE TABLE t4(x,y); INSERT INTO t4 VALUES(1,2); SELECT * FROM t4; } } {1 2} do_test insert2-2.1 { execsql { INSERT INTO t3(a,c) SELECT * FROM t4; SELECT * FROM t3; } } {1 {} 2} do_test insert2-2.2 { execsql { DELETE FROM t3; INSERT INTO t3(c,b) SELECT * FROM t4; SELECT * FROM t3; } } {{} 2 1} do_test insert2-2.3 { execsql { DELETE FROM t3; INSERT INTO t3(c,a,b) SELECT x, 'hi', y FROM t4; SELECT * FROM t3; } } {hi 2 1} integrity_check insert2-3.0 # File table t4 with lots of data # do_test insert2-3.1 { execsql { SELECT * from t4; } } {1 2} do_test insert2-3.2 { execsql { BEGIN; INSERT INTO t4 VALUES(2,4); INSERT INTO t4 VALUES(3,6); INSERT INTO t4 VALUES(4,8); INSERT INTO t4 VALUES(5,10); INSERT INTO t4 VALUES(6,12); INSERT INTO t4 VALUES(7,14); INSERT INTO t4 VALUES(8,16); INSERT INTO t4 VALUES(9,18); INSERT INTO t4 VALUES(10,20); COMMIT; } db changes } {9} do_test insert2-3.2.1 { execsql { SELECT count(*) FROM t4; } } {10} do_test insert2-3.3 { execsql { BEGIN; INSERT INTO t4 SELECT x+(SELECT max(x) FROM t4),y FROM t4; INSERT INTO t4 SELECT x+(SELECT max(x) FROM t4),y FROM t4; INSERT INTO t4 SELECT x+(SELECT max(x) FROM t4),y FROM t4; INSERT INTO t4 SELECT x+(SELECT max(x) FROM t4),y FROM t4; COMMIT; SELECT count(*) FROM t4; } } {160} do_test insert2-3.4 { execsql { BEGIN; UPDATE t4 SET y='lots of data for the row where x=' || x || ' and y=' || y || ' - even more data to fill space'; COMMIT; SELECT count(*) FROM t4; } } {160} do_test insert2-3.5 { execsql { BEGIN; INSERT INTO t4 SELECT x+(SELECT max(x)+1 FROM t4),y FROM t4; SELECT count(*) from t4; ROLLBACK; } } {320} do_test insert2-3.6 { execsql { SELECT count(*) FROM t4; } } {160} do_test insert2-3.7 { execsql { BEGIN; DELETE FROM t4 WHERE x!=123; SELECT count(*) FROM t4; ROLLBACK; } } {1} do_test insert2-3.8 { db changes } {159} integrity_check insert2-3.9 finish_test sqlite-2.8.17/test/btree3rb.test0000644000175000001440000000447410232547612016451 0ustar drhusers00000000000000# 2001 November 22 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # In particular, this file tests a small part of the Delete logic # for the BTree backend. When a row is deleted from a table, the # cursor is suppose to be left pointing at either the previous or # next entry in that table. If the cursor is left pointing at the # next entry, then the next Next operation is ignored. So the # sequence of operations (Delete, Next) should always leave the # cursor pointing at the first entry past the one that was deleted. # This test is designed to verify that behavior. # # $Id: btree3rb.test,v 1.1 2003/04/20 23:45:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Open a test database. # set b1 [btree_open :memory:] btree_begin_transaction $::b1 # Insert a few one records # set data {abcdefghijklmnopqrstuvwxyz0123456789} append data $data append data $data append data $data append data $data for {set k 2} {$k<=20} {incr k} { for {set j 1} {$j<=$k} {incr j} { set jkey [format %02d $j] btree_clear_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] for {set i 1} {$i<=$k} {incr i} { set key [format %02d $i] do_test btree3rb-$k.$j.1.$i { btree_insert $::c1 $::key $::data } {} # btree_tree_dump $::b1 2 } do_test btree3rb-$k.$j.2 { btree_move_to $::c1 $::jkey btree_key $::c1 } $::jkey do_test btree3rb-$k.$j.3 { btree_delete $::c1 } {} if {$j<$k} { do_test btree3rb-$k.$j.4 { btree_next $::c1 btree_key $::c1 } [format %02d [expr $j+1]] } if {$j>1} { do_test btree3rb-$k.$j.5 { btree_prev $::c1 btree_key $::c1 } [format %02d [expr $j-1]] } btree_close_cursor $::c1 } } btree_rollback $::b1 #btree_pager_ref_dump $::b1 btree_close $::b1 } ;# end if( not mem: and has pager_open command ); finish_test sqlite-2.8.17/test/bigfile.test0000644000175000001440000000776310232547612016346 0ustar drhusers00000000000000# 2002 November 30 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the ability of SQLite to handle database # files larger than 4GB. # # $Id: bigfile.test,v 1.3 2003/12/19 12:31:22 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # These tests only work for Tcl version 8.4 and later. Prior to 8.4, # Tcl was unable to handle large files. # scan $::tcl_version %f vx if {$vx<8.4} return # This is the md5 checksum of all the data in table t1 as created # by the first test. We will use this number to make sure that data # never changes. # set MAGIC_SUM {593f1efcfdbe698c28b4b1b693f7e4cf} do_test bigfile-1.1 { execsql { BEGIN; CREATE TABLE t1(x); INSERT INTO t1 VALUES('abcdefghijklmnopqrstuvwxyz'); INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; INSERT INTO t1 SELECT rowid || ' ' || x FROM t1; COMMIT; } execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM # Try to create a large file - a file that is larger than 2^32 bytes. # If this fails, it means that the system being tested does not support # large files. So skip all of the remaining tests in this file. # db close if {[catch {fake_big_file 4096 test.db}]} { puts "**** Unable to create a file larger than 4096 MB. *****" finish_test return } do_test bigfile-1.2 { sqlite db test.db execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM # The previous test may fail on some systems because they are unable # to handle large files. If that is so, then skip all of the following # tests. We will know the above test failed because the "db" command # does not exist. # if {[llength [info command db]]>0} { do_test bigfile-1.3 { execsql { CREATE TABLE t2 AS SELECT * FROM t1; SELECT md5sum(x) FROM t2; } } $::MAGIC_SUM do_test bigfile-1.4 { db close sqlite db test.db execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM do_test bigfile-1.5 { execsql { SELECT md5sum(x) FROM t2; } } $::MAGIC_SUM db close if {[catch {fake_big_file 8192 test.db}]} { puts "**** Unable to create a file larger than 8192 MB. *****" finish_test return } do_test bigfile-1.6 { sqlite db test.db execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM do_test bigfile-1.7 { execsql { CREATE TABLE t3 AS SELECT * FROM t1; SELECT md5sum(x) FROM t3; } } $::MAGIC_SUM do_test bigfile-1.8 { db close sqlite db test.db execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM do_test bigfile-1.9 { execsql { SELECT md5sum(x) FROM t2; } } $::MAGIC_SUM do_test bigfile-1.10 { execsql { SELECT md5sum(x) FROM t3; } } $::MAGIC_SUM db close if {[catch {fake_big_file 16384 test.db}]} { puts "**** Unable to create a file larger than 16384 MB. *****" finish_test return } do_test bigfile-1.11 { sqlite db test.db execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM do_test bigfile-1.12 { execsql { CREATE TABLE t4 AS SELECT * FROM t1; SELECT md5sum(x) FROM t4; } } $::MAGIC_SUM do_test bigfile-1.13 { db close sqlite db test.db execsql { SELECT md5sum(x) FROM t1; } } $::MAGIC_SUM do_test bigfile-1.14 { execsql { SELECT md5sum(x) FROM t2; } } $::MAGIC_SUM do_test bigfile-1.15 { execsql { SELECT md5sum(x) FROM t3; } } $::MAGIC_SUM do_test bigfile-1.16 { execsql { SELECT md5sum(x) FROM t3; } } $::MAGIC_SUM } ;# End of the "if( db command exists )" finish_test sqlite-2.8.17/test/select1.test0000644000175000001440000004612410232547612016277 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # # $Id: select1.test,v 1.30.2.3 2004/07/20 01:45:49 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to select on a non-existant table. # do_test select1-1.1 { set v [catch {execsql {SELECT * FROM test1}} msg] lappend v $msg } {1 {no such table: test1}} execsql {CREATE TABLE test1(f1 int, f2 int)} do_test select1-1.2 { set v [catch {execsql {SELECT * FROM test1, test2}} msg] lappend v $msg } {1 {no such table: test2}} do_test select1-1.3 { set v [catch {execsql {SELECT * FROM test2, test1}} msg] lappend v $msg } {1 {no such table: test2}} execsql {INSERT INTO test1(f1,f2) VALUES(11,22)} # Make sure the columns are extracted correctly. # do_test select1-1.4 { execsql {SELECT f1 FROM test1} } {11} do_test select1-1.5 { execsql {SELECT f2 FROM test1} } {22} do_test select1-1.6 { execsql {SELECT f2, f1 FROM test1} } {22 11} do_test select1-1.7 { execsql {SELECT f1, f2 FROM test1} } {11 22} do_test select1-1.8 { execsql {SELECT * FROM test1} } {11 22} do_test select1-1.8.1 { execsql {SELECT *, * FROM test1} } {11 22 11 22} do_test select1-1.8.2 { execsql {SELECT *, min(f1,f2), max(f1,f2) FROM test1} } {11 22 11 22} do_test select1-1.8.3 { execsql {SELECT 'one', *, 'two', * FROM test1} } {one 11 22 two 11 22} execsql {CREATE TABLE test2(r1 real, r2 real)} execsql {INSERT INTO test2(r1,r2) VALUES(1.1,2.2)} do_test select1-1.9 { execsql {SELECT * FROM test1, test2} } {11 22 1.1 2.2} do_test select1-1.9.1 { execsql {SELECT *, 'hi' FROM test1, test2} } {11 22 1.1 2.2 hi} do_test select1-1.9.2 { execsql {SELECT 'one', *, 'two', * FROM test1, test2} } {one 11 22 1.1 2.2 two 11 22 1.1 2.2} do_test select1-1.10 { execsql {SELECT test1.f1, test2.r1 FROM test1, test2} } {11 1.1} do_test select1-1.11 { execsql {SELECT test1.f1, test2.r1 FROM test2, test1} } {11 1.1} do_test select1-1.11.1 { execsql {SELECT * FROM test2, test1} } {1.1 2.2 11 22} do_test select1-1.11.2 { execsql {SELECT * FROM test1 AS a, test1 AS b} } {11 22 11 22} do_test select1-1.12 { execsql {SELECT max(test1.f1,test2.r1), min(test1.f2,test2.r2) FROM test2, test1} } {11 2.2} do_test select1-1.13 { execsql {SELECT min(test1.f1,test2.r1), max(test1.f2,test2.r2) FROM test1, test2} } {1.1 22} set long {This is a string that is too big to fit inside a NBFS buffer} do_test select1-2.0 { execsql " DROP TABLE test2; DELETE FROM test1; INSERT INTO test1 VALUES(11,22); INSERT INTO test1 VALUES(33,44); CREATE TABLE t3(a,b); INSERT INTO t3 VALUES('abc',NULL); INSERT INTO t3 VALUES(NULL,'xyz'); INSERT INTO t3 SELECT * FROM test1; CREATE TABLE t4(a,b); INSERT INTO t4 VALUES(NULL,'$long'); SELECT * FROM t3; " } {abc {} {} xyz 11 22 33 44} # Error messges from sqliteExprCheck # do_test select1-2.1 { set v [catch {execsql {SELECT count(f1,f2) FROM test1}} msg] lappend v $msg } {1 {wrong number of arguments to function count()}} do_test select1-2.2 { set v [catch {execsql {SELECT count(f1) FROM test1}} msg] lappend v $msg } {0 2} do_test select1-2.3 { set v [catch {execsql {SELECT Count() FROM test1}} msg] lappend v $msg } {0 2} do_test select1-2.4 { set v [catch {execsql {SELECT COUNT(*) FROM test1}} msg] lappend v $msg } {0 2} do_test select1-2.5 { set v [catch {execsql {SELECT COUNT(*)+1 FROM test1}} msg] lappend v $msg } {0 3} do_test select1-2.5.1 { execsql {SELECT count(*),count(a),count(b) FROM t3} } {4 3 3} do_test select1-2.5.2 { execsql {SELECT count(*),count(a),count(b) FROM t4} } {1 0 1} do_test select1-2.5.3 { execsql {SELECT count(*),count(a),count(b) FROM t4 WHERE b=5} } {0 0 0} do_test select1-2.6 { set v [catch {execsql {SELECT min(*) FROM test1}} msg] lappend v $msg } {1 {wrong number of arguments to function min()}} do_test select1-2.7 { set v [catch {execsql {SELECT Min(f1) FROM test1}} msg] lappend v $msg } {0 11} do_test select1-2.8 { set v [catch {execsql {SELECT MIN(f1,f2) FROM test1}} msg] lappend v [lsort $msg] } {0 {11 33}} do_test select1-2.8.1 { execsql {SELECT coalesce(min(a),'xyzzy') FROM t3} } {11} do_test select1-2.8.2 { execsql {SELECT min(coalesce(a,'xyzzy')) FROM t3} } {11} do_test select1-2.8.3 { execsql {SELECT min(b), min(b) FROM t4} } [list $long $long] do_test select1-2.9 { set v [catch {execsql {SELECT MAX(*) FROM test1}} msg] lappend v $msg } {1 {wrong number of arguments to function MAX()}} do_test select1-2.10 { set v [catch {execsql {SELECT Max(f1) FROM test1}} msg] lappend v $msg } {0 33} do_test select1-2.11 { set v [catch {execsql {SELECT max(f1,f2) FROM test1}} msg] lappend v [lsort $msg] } {0 {22 44}} do_test select1-2.12 { set v [catch {execsql {SELECT MAX(f1,f2)+1 FROM test1}} msg] lappend v [lsort $msg] } {0 {23 45}} do_test select1-2.13 { set v [catch {execsql {SELECT MAX(f1)+1 FROM test1}} msg] lappend v $msg } {0 34} do_test select1-2.13.1 { execsql {SELECT coalesce(max(a),'xyzzy') FROM t3} } {abc} do_test select1-2.13.2 { execsql {SELECT max(coalesce(a,'xyzzy')) FROM t3} } {xyzzy} do_test select1-2.14 { set v [catch {execsql {SELECT SUM(*) FROM test1}} msg] lappend v $msg } {1 {wrong number of arguments to function SUM()}} do_test select1-2.15 { set v [catch {execsql {SELECT Sum(f1) FROM test1}} msg] lappend v $msg } {0 44} do_test select1-2.16 { set v [catch {execsql {SELECT sum(f1,f2) FROM test1}} msg] lappend v $msg } {1 {wrong number of arguments to function sum()}} do_test select1-2.17 { set v [catch {execsql {SELECT SUM(f1)+1 FROM test1}} msg] lappend v $msg } {0 45} do_test select1-2.17.1 { execsql {SELECT sum(a) FROM t3} } {44} do_test select1-2.18 { set v [catch {execsql {SELECT XYZZY(f1) FROM test1}} msg] lappend v $msg } {1 {no such function: XYZZY}} do_test select1-2.19 { set v [catch {execsql {SELECT SUM(min(f1,f2)) FROM test1}} msg] lappend v $msg } {0 44} do_test select1-2.20 { set v [catch {execsql {SELECT SUM(min(f1)) FROM test1}} msg] lappend v $msg } {1 {misuse of aggregate function min()}} # WHERE clause expressions # do_test select1-3.1 { set v [catch {execsql {SELECT f1 FROM test1 WHERE f1<11}} msg] lappend v $msg } {0 {}} do_test select1-3.2 { set v [catch {execsql {SELECT f1 FROM test1 WHERE f1<=11}} msg] lappend v $msg } {0 11} do_test select1-3.3 { set v [catch {execsql {SELECT f1 FROM test1 WHERE f1=11}} msg] lappend v $msg } {0 11} do_test select1-3.4 { set v [catch {execsql {SELECT f1 FROM test1 WHERE f1>=11}} msg] lappend v [lsort $msg] } {0 {11 33}} do_test select1-3.5 { set v [catch {execsql {SELECT f1 FROM test1 WHERE f1>11}} msg] lappend v [lsort $msg] } {0 33} do_test select1-3.6 { set v [catch {execsql {SELECT f1 FROM test1 WHERE f1!=11}} msg] lappend v [lsort $msg] } {0 33} do_test select1-3.7 { set v [catch {execsql {SELECT f1 FROM test1 WHERE min(f1,f2)!=11}} msg] lappend v [lsort $msg] } {0 33} do_test select1-3.8 { set v [catch {execsql {SELECT f1 FROM test1 WHERE max(f1,f2)!=11}} msg] lappend v [lsort $msg] } {0 {11 33}} do_test select1-3.9 { set v [catch {execsql {SELECT f1 FROM test1 WHERE count(f1,f2)!=11}} msg] lappend v $msg } {1 {wrong number of arguments to function count()}} # ORDER BY expressions # do_test select1-4.1 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY f1}} msg] lappend v $msg } {0 {11 33}} do_test select1-4.2 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY -f1}} msg] lappend v $msg } {0 {33 11}} do_test select1-4.3 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1,f2)}} msg] lappend v $msg } {0 {11 33}} do_test select1-4.4 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1)}} msg] lappend v $msg } {1 {misuse of aggregate function min()}} do_test select1-4.5 { catchsql { SELECT f1 FROM test1 ORDER BY 8.4; } } {1 {ORDER BY terms must not be non-integer constants}} do_test select1-4.6 { catchsql { SELECT f1 FROM test1 ORDER BY '8.4'; } } {1 {ORDER BY terms must not be non-integer constants}} do_test select1-4.7 { catchsql { SELECT f1 FROM test1 ORDER BY 'xyz'; } } {1 {ORDER BY terms must not be non-integer constants}} do_test select1-4.8 { execsql { CREATE TABLE t5(a,b); INSERT INTO t5 VALUES(1,10); INSERT INTO t5 VALUES(2,9); SELECT * FROM t5 ORDER BY 1; } } {1 10 2 9} do_test select1-4.9 { execsql { SELECT * FROM t5 ORDER BY 2; } } {2 9 1 10} do_test select1-4.10 { catchsql { SELECT * FROM t5 ORDER BY 3; } } {1 {ORDER BY column number 3 out of range - should be between 1 and 2}} do_test select1-4.11 { execsql { INSERT INTO t5 VALUES(3,10); SELECT * FROM t5 ORDER BY 2, 1 DESC; } } {2 9 3 10 1 10} do_test select1-4.12 { execsql { SELECT * FROM t5 ORDER BY 1 DESC, b; } } {3 10 2 9 1 10} do_test select1-4.13 { execsql { SELECT * FROM t5 ORDER BY b DESC, 1; } } {1 10 3 10 2 9} # ORDER BY ignored on an aggregate query # do_test select1-5.1 { set v [catch {execsql {SELECT max(f1) FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 33} execsql {CREATE TABLE test2(t1 test, t2 text)} execsql {INSERT INTO test2 VALUES('abc','xyz')} # Check for column naming # do_test select1-6.1 { set v [catch {execsql2 {SELECT f1 FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {f1 11 f1 33}} do_test select1-6.1.1 { execsql {PRAGMA full_column_names=on} set v [catch {execsql2 {SELECT f1 FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {test1.f1 11 test1.f1 33}} do_test select1-6.1.2 { set v [catch {execsql2 {SELECT f1 as 'f1' FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {f1 11 f1 33}} do_test select1-6.1.3 { set v [catch {execsql2 {SELECT * FROM test1 WHERE f1==11}} msg] lappend v $msg } {0 {test1.f1 11 test1.f2 22}} do_test select1-6.1.4 { set v [catch {execsql2 {SELECT DISTINCT * FROM test1 WHERE f1==11}} msg] execsql {PRAGMA full_column_names=off} lappend v $msg } {0 {test1.f1 11 test1.f2 22}} do_test select1-6.1.5 { set v [catch {execsql2 {SELECT * FROM test1 WHERE f1==11}} msg] lappend v $msg } {0 {f1 11 f2 22}} do_test select1-6.1.6 { set v [catch {execsql2 {SELECT DISTINCT * FROM test1 WHERE f1==11}} msg] lappend v $msg } {0 {f1 11 f2 22}} do_test select1-6.2 { set v [catch {execsql2 {SELECT f1 as xyzzy FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {xyzzy 11 xyzzy 33}} do_test select1-6.3 { set v [catch {execsql2 {SELECT f1 as "xyzzy" FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {xyzzy 11 xyzzy 33}} do_test select1-6.3.1 { set v [catch {execsql2 {SELECT f1 as 'xyzzy ' FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {{xyzzy } 11 {xyzzy } 33}} do_test select1-6.4 { set v [catch {execsql2 {SELECT f1+F2 as xyzzy FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {xyzzy 33 xyzzy 77}} do_test select1-6.4a { set v [catch {execsql2 {SELECT f1+F2 FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {f1+F2 33 f1+F2 77}} do_test select1-6.5 { set v [catch {execsql2 {SELECT test1.f1+F2 FROM test1 ORDER BY f2}} msg] lappend v $msg } {0 {test1.f1+F2 33 test1.f1+F2 77}} do_test select1-6.5.1 { execsql2 {PRAGMA full_column_names=on} set v [catch {execsql2 {SELECT test1.f1+F2 FROM test1 ORDER BY f2}} msg] execsql2 {PRAGMA full_column_names=off} lappend v $msg } {0 {test1.f1+F2 33 test1.f1+F2 77}} do_test select1-6.6 { set v [catch {execsql2 {SELECT test1.f1+F2, t1 FROM test1, test2 ORDER BY f2}} msg] lappend v $msg } {0 {test1.f1+F2 33 t1 abc test1.f1+F2 77 t1 abc}} do_test select1-6.7 { set v [catch {execsql2 {SELECT A.f1, t1 FROM test1 as A, test2 ORDER BY f2}} msg] lappend v $msg } {0 {A.f1 11 t1 abc A.f1 33 t1 abc}} do_test select1-6.8 { set v [catch {execsql2 {SELECT A.f1, f1 FROM test1 as A, test1 as B ORDER BY f2}} msg] lappend v $msg } {1 {ambiguous column name: f1}} do_test select1-6.8b { set v [catch {execsql2 {SELECT A.f1, B.f1 FROM test1 as A, test1 as B ORDER BY f2}} msg] lappend v $msg } {1 {ambiguous column name: f2}} do_test select1-6.8c { set v [catch {execsql2 {SELECT A.f1, f1 FROM test1 as A, test1 as A ORDER BY f2}} msg] lappend v $msg } {1 {ambiguous column name: A.f1}} do_test select1-6.9 { set v [catch {execsql2 {SELECT A.f1, B.f1 FROM test1 as A, test1 as B ORDER BY A.f1, B.f1}} msg] lappend v $msg } {0 {A.f1 11 B.f1 11 A.f1 11 B.f1 33 A.f1 33 B.f1 11 A.f1 33 B.f1 33}} do_test select1-6.10 { set v [catch {execsql2 { SELECT f1 FROM test1 UNION SELECT f2 FROM test1 ORDER BY f2; }} msg] lappend v $msg } {0 {f2 11 f2 22 f2 33 f2 44}} do_test select1-6.11 { set v [catch {execsql2 { SELECT f1 FROM test1 UNION SELECT f2+100 FROM test1 ORDER BY f2+100; }} msg] lappend v $msg } {0 {f2+100 11 f2+100 33 f2+100 122 f2+100 144}} do_test select1-7.1 { set v [catch {execsql { SELECT f1 FROM test1 WHERE f2=; }} msg] lappend v $msg } {1 {near ";": syntax error}} do_test select1-7.2 { set v [catch {execsql { SELECT f1 FROM test1 UNION SELECT WHERE; }} msg] lappend v $msg } {1 {near "WHERE": syntax error}} do_test select1-7.3 { set v [catch {execsql {SELECT f1 FROM test1 as 'hi', test2 as}} msg] lappend v $msg } {1 {near "as": syntax error}} do_test select1-7.4 { set v [catch {execsql { SELECT f1 FROM test1 ORDER BY; }} msg] lappend v $msg } {1 {near ";": syntax error}} do_test select1-7.5 { set v [catch {execsql { SELECT f1 FROM test1 ORDER BY f1 desc, f2 where; }} msg] lappend v $msg } {1 {near "where": syntax error}} do_test select1-7.6 { set v [catch {execsql { SELECT count(f1,f2 FROM test1; }} msg] lappend v $msg } {1 {near "FROM": syntax error}} do_test select1-7.7 { set v [catch {execsql { SELECT count(f1,f2+) FROM test1; }} msg] lappend v $msg } {1 {near ")": syntax error}} do_test select1-7.8 { set v [catch {execsql { SELECT f1 FROM test1 ORDER BY f2, f1+; }} msg] lappend v $msg } {1 {near ";": syntax error}} do_test select1-8.1 { execsql {SELECT f1 FROM test1 WHERE 4.3+2.4 OR 1 ORDER BY f1} } {11 33} do_test select1-8.2 { execsql { SELECT f1 FROM test1 WHERE ('x' || f1) BETWEEN 'x10' AND 'x20' ORDER BY f1 } } {11} do_test select1-8.3 { execsql { SELECT f1 FROM test1 WHERE 5-3==2 ORDER BY f1 } } {11 33} do_test select1-8.4 { execsql { SELECT coalesce(f1/(f1-11),'x'), coalesce(min(f1/(f1-11),5),'y'), coalesce(max(f1/(f1-33),6),'z') FROM test1 ORDER BY f1 } } {x y 6 1.5 1.5 z} do_test select1-8.5 { execsql { SELECT min(1,2,3), -max(1,2,3) FROM test1 ORDER BY f1 } } {1 -3 1 -3} # Check the behavior when the result set is empty # do_test select1-9.1 { catch {unset r} set r(*) {} db eval {SELECT * FROM test1 WHERE f1<0} r {} set r(*) } {} do_test select1-9.2 { execsql {PRAGMA empty_result_callbacks=on} set r(*) {} db eval {SELECT * FROM test1 WHERE f1<0} r {} set r(*) } {f1 f2} do_test select1-9.3 { set r(*) {} db eval {SELECT * FROM test1 WHERE f1<(select count(*) from test2)} r {} set r(*) } {f1 f2} do_test select1-9.4 { set r(*) {} db eval {SELECT * FROM test1 ORDER BY f1} r {} set r(*) } {f1 f2} do_test select1-9.5 { set r(*) {} db eval {SELECT * FROM test1 WHERE f1<0 ORDER BY f1} r {} set r(*) } {f1 f2} unset r # Check for ORDER BY clauses that refer to an AS name in the column list # do_test select1-10.1 { execsql { SELECT f1 AS x FROM test1 ORDER BY x } } {11 33} do_test select1-10.2 { execsql { SELECT f1 AS x FROM test1 ORDER BY -x } } {33 11} do_test select1-10.3 { execsql { SELECT f1-23 AS x FROM test1 ORDER BY abs(x) } } {10 -12} do_test select1-10.4 { execsql { SELECT f1-23 AS x FROM test1 ORDER BY -abs(x) } } {-12 10} do_test select1-10.5 { execsql { SELECT f1-22 AS x, f2-22 as y FROM test1 } } {-11 0 11 22} do_test select1-10.6 { execsql { SELECT f1-22 AS x, f2-22 as y FROM test1 WHERE x>0 AND y<50 } } {11 22} # Check the ability to specify "TABLE.*" in the result set of a SELECT # do_test select1-11.1 { execsql { DELETE FROM t3; DELETE FROM t4; INSERT INTO t3 VALUES(1,2); INSERT INTO t4 VALUES(3,4); SELECT * FROM t3, t4; } } {1 2 3 4} do_test select1-11.2 { execsql2 { SELECT * FROM t3, t4; } } {t3.a 1 t3.b 2 t4.a 3 t4.b 4} do_test select1-11.3 { execsql2 { SELECT * FROM t3 AS x, t4 AS y; } } {x.a 1 x.b 2 y.a 3 y.b 4} do_test select1-11.4.1 { execsql { SELECT t3.*, t4.b FROM t3, t4; } } {1 2 4} do_test select1-11.4.2 { execsql { SELECT "t3".*, t4.b FROM t3, t4; } } {1 2 4} do_test select1-11.5 { execsql2 { SELECT t3.*, t4.b FROM t3, t4; } } {t3.a 1 t3.b 2 t4.b 4} do_test select1-11.6 { execsql2 { SELECT x.*, y.b FROM t3 AS x, t4 AS y; } } {x.a 1 x.b 2 y.b 4} do_test select1-11.7 { execsql { SELECT t3.b, t4.* FROM t3, t4; } } {2 3 4} do_test select1-11.8 { execsql2 { SELECT t3.b, t4.* FROM t3, t4; } } {t3.b 2 t4.a 3 t4.b 4} do_test select1-11.9 { execsql2 { SELECT x.b, y.* FROM t3 AS x, t4 AS y; } } {x.b 2 y.a 3 y.b 4} do_test select1-11.10 { catchsql { SELECT t5.* FROM t3, t4; } } {1 {no such table: t5}} do_test select1-11.11 { catchsql { SELECT t3.* FROM t3 AS x, t4; } } {1 {no such table: t3}} do_test select1-11.12 { execsql2 { SELECT t3.* FROM t3, (SELECT max(a), max(b) FROM t4) } } {t3.a 1 t3.b 2} do_test select1-11.13 { execsql2 { SELECT t3.* FROM (SELECT max(a), max(b) FROM t4), t3 } } {t3.a 1 t3.b 2} do_test select1-11.14 { execsql2 { SELECT * FROM t3, (SELECT max(a), max(b) FROM t4) AS 'tx' } } {t3.a 1 t3.b 2 tx.max(a) 3 tx.max(b) 4} do_test select1-11.15 { execsql2 { SELECT y.*, t3.* FROM t3, (SELECT max(a), max(b) FROM t4) AS y } } {y.max(a) 3 y.max(b) 4 t3.a 1 t3.b 2} do_test select1-11.16 { execsql2 { SELECT y.* FROM t3 as y, t4 as z } } {y.a 1 y.b 2} # Tests of SELECT statements without a FROM clause. # do_test select1-12.1 { execsql2 { SELECT 1+2+3 } } {1+2+3 6} do_test select1-12.2 { execsql2 { SELECT 1,'hello',2 } } {1 1 'hello' hello 2 2} do_test select1-12.3 { execsql2 { SELECT 1 AS 'a','hello' AS 'b',2 AS 'c' } } {a 1 b hello c 2} do_test select1-12.4 { execsql { DELETE FROM t3; INSERT INTO t3 VALUES(1,2); SELECT * FROM t3 UNION SELECT 3 AS 'a', 4 ORDER BY a; } } {1 2 3 4} do_test select1-12.5 { execsql { SELECT 3, 4 UNION SELECT * FROM t3; } } {1 2 3 4} do_test select1-12.6 { execsql { SELECT * FROM t3 WHERE a=(SELECT 1); } } {1 2} do_test select1-12.7 { execsql { SELECT * FROM t3 WHERE a=(SELECT 2); } } {} do_test select1-12.8 { execsql2 { SELECT x FROM ( SELECT a,b FROM t3 UNION SELECT a AS 'x', b AS 'y' FROM t4 ORDER BY a,b ) ORDER BY x; } } {x 1 x 3} do_test select1-12.9 { execsql2 { SELECT z.x FROM ( SELECT a,b FROM t3 UNION SELECT a AS 'x', b AS 'y' FROM t4 ORDER BY a,b ) AS 'z' ORDER BY x; } } {z.x 1 z.x 3} finish_test sqlite-2.8.17/test/notnull.test0000644000175000001440000002732410232547612016433 0ustar drhusers00000000000000# 2002 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the NOT NULL constraint. # # $Id: notnull.test,v 1.3 2003/01/29 18:46:54 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test notnull-1.0 { execsql { CREATE TABLE t1 ( a NOT NULL, b NOT NULL DEFAULT 5, c NOT NULL ON CONFLICT REPLACE DEFAULT 6, d NOT NULL ON CONFLICT IGNORE DEFAULT 7, e NOT NULL ON CONFLICT ABORT DEFAULT 8 ); SELECT * FROM t1; } } {} do_test notnull-1.1 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 2 3 4 5}} do_test notnull-1.2 { catchsql { DELETE FROM t1; INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.a may not be NULL}} do_test notnull-1.3 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {0 {}} do_test notnull-1.4 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.a may not be NULL}} do_test notnull-1.5 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.a may not be NULL}} do_test notnull-1.6 { catchsql { DELETE FROM t1; INSERT INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-1.7 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-1.8 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-1.9 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-1.10 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.b may not be NULL}} do_test notnull-1.11 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5); SELECT * FROM t1 order by a; } } {0 {}} do_test notnull-1.12 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-1.13 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {0 {1 2 6 4 5}} do_test notnull-1.14 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {0 {}} do_test notnull-1.15 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {0 {1 2 6 4 5}} do_test notnull-1.16 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {1 {t1.c may not be NULL}} do_test notnull-1.17 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5); SELECT * FROM t1 order by a; } } {1 {t1.d may not be NULL}} do_test notnull-1.18 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,b,c,e) VALUES(1,2,3,5); SELECT * FROM t1 order by a; } } {0 {1 2 3 7 5}} do_test notnull-1.19 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d) VALUES(1,2,3,4); SELECT * FROM t1 order by a; } } {0 {1 2 3 4 8}} do_test notnull-1.20 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null); SELECT * FROM t1 order by a; } } {1 {t1.e may not be NULL}} do_test notnull-1.21 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(e,d,c,b,a) VALUES(1,2,3,null,5); SELECT * FROM t1 order by a; } } {0 {5 5 3 2 1}} do_test notnull-2.1 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.a may not be NULL}} do_test notnull-2.2 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR REPLACE t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.a may not be NULL}} do_test notnull-2.3 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR IGNORE t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 3 4 5}} do_test notnull-2.4 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR ABORT t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.a may not be NULL}} do_test notnull-2.5 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET b=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.b may not be NULL}} do_test notnull-2.6 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR REPLACE t1 SET b=null, d=e, e=d; SELECT * FROM t1 ORDER BY a; } } {0 {1 5 3 5 4}} do_test notnull-2.7 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR IGNORE t1 SET b=null, d=e, e=d; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 3 4 5}} do_test notnull-2.8 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET c=null, d=e, e=d; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 6 5 4}} do_test notnull-2.9 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET d=null, a=b, b=a; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 3 4 5}} do_test notnull-2.10 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET e=null, a=b, b=a; SELECT * FROM t1 ORDER BY a; } } {1 {t1.e may not be NULL}} do_test notnull-3.0 { execsql { CREATE INDEX t1a ON t1(a); CREATE INDEX t1b ON t1(b); CREATE INDEX t1c ON t1(c); CREATE INDEX t1d ON t1(d); CREATE INDEX t1e ON t1(e); CREATE INDEX t1abc ON t1(a,b,c); } } {} do_test notnull-3.1 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 2 3 4 5}} do_test notnull-3.2 { catchsql { DELETE FROM t1; INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.a may not be NULL}} do_test notnull-3.3 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {0 {}} do_test notnull-3.4 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.a may not be NULL}} do_test notnull-3.5 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.a may not be NULL}} do_test notnull-3.6 { catchsql { DELETE FROM t1; INSERT INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-3.7 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-3.8 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-3.9 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,c,d,e) VALUES(1,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-3.10 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5); SELECT * FROM t1 order by a; } } {1 {t1.b may not be NULL}} do_test notnull-3.11 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5); SELECT * FROM t1 order by a; } } {0 {}} do_test notnull-3.12 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5); SELECT * FROM t1 order by a; } } {0 {1 5 3 4 5}} do_test notnull-3.13 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {0 {1 2 6 4 5}} do_test notnull-3.14 { catchsql { DELETE FROM t1; INSERT OR IGNORE INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {0 {}} do_test notnull-3.15 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {0 {1 2 6 4 5}} do_test notnull-3.16 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5); SELECT * FROM t1 order by a; } } {1 {t1.c may not be NULL}} do_test notnull-3.17 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5); SELECT * FROM t1 order by a; } } {1 {t1.d may not be NULL}} do_test notnull-3.18 { catchsql { DELETE FROM t1; INSERT OR ABORT INTO t1(a,b,c,e) VALUES(1,2,3,5); SELECT * FROM t1 order by a; } } {0 {1 2 3 7 5}} do_test notnull-3.19 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d) VALUES(1,2,3,4); SELECT * FROM t1 order by a; } } {0 {1 2 3 4 8}} do_test notnull-3.20 { catchsql { DELETE FROM t1; INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null); SELECT * FROM t1 order by a; } } {1 {t1.e may not be NULL}} do_test notnull-3.21 { catchsql { DELETE FROM t1; INSERT OR REPLACE INTO t1(e,d,c,b,a) VALUES(1,2,3,null,5); SELECT * FROM t1 order by a; } } {0 {5 5 3 2 1}} do_test notnull-4.1 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.a may not be NULL}} do_test notnull-4.2 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR REPLACE t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.a may not be NULL}} do_test notnull-4.3 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR IGNORE t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 3 4 5}} do_test notnull-4.4 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR ABORT t1 SET a=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.a may not be NULL}} do_test notnull-4.5 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET b=null; SELECT * FROM t1 ORDER BY a; } } {1 {t1.b may not be NULL}} do_test notnull-4.6 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR REPLACE t1 SET b=null, d=e, e=d; SELECT * FROM t1 ORDER BY a; } } {0 {1 5 3 5 4}} do_test notnull-4.7 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE OR IGNORE t1 SET b=null, d=e, e=d; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 3 4 5}} do_test notnull-4.8 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET c=null, d=e, e=d; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 6 5 4}} do_test notnull-4.9 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET d=null, a=b, b=a; SELECT * FROM t1 ORDER BY a; } } {0 {1 2 3 4 5}} do_test notnull-4.10 { catchsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2,3,4,5); UPDATE t1 SET e=null, a=b, b=a; SELECT * FROM t1 ORDER BY a; } } {1 {t1.e may not be NULL}} finish_test sqlite-2.8.17/test/select2.test0000644000175000001440000000752710232547612016304 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # # $Id: select2.test,v 1.18 2002/04/02 13:26:11 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table with some data # execsql {CREATE TABLE tbl1(f1 int, f2 int)} set f [open ./testdata1.txt w] for {set i 0} {$i<=30} {incr i} { puts $f "[expr {$i%9}]\t[expr {$i%10}]" } close $f execsql {COPY tbl1 FROM './testdata1.txt'} file delete -force ./testdata1.txt catch {unset data} # Do a second query inside a first. # do_test select2-1.1 { set sql {SELECT DISTINCT f1 FROM tbl1 ORDER BY f1} set r {} db eval $sql data { set f1 $data(f1) lappend r $f1: set sql2 "SELECT f2 FROM tbl1 WHERE f1=$f1 ORDER BY f2" db eval $sql2 d2 { lappend r $d2(f2) } } set r } {0: 0 7 8 9 1: 0 1 8 9 2: 0 1 2 9 3: 0 1 2 3 4: 2 3 4 5: 3 4 5 6: 4 5 6 7: 5 6 7 8: 6 7 8} do_test select2-1.2 { set sql {SELECT DISTINCT f1 FROM tbl1 WHERE f1>3 AND f1<5} set r {} db eval $sql data { set f1 $data(f1) lappend r $f1: set sql2 "SELECT f2 FROM tbl1 WHERE f1=$f1 ORDER BY f2" db eval $sql2 d2 { lappend r $d2(f2) } } set r } {4: 2 3 4} # Create a largish table # do_test select2-2.0 { execsql {CREATE TABLE tbl2(f1 int, f2 int, f3 int)} set f [open ./testdata1.txt w] for {set i 1} {$i<=30000} {incr i} { puts $f "$i\t[expr {$i*2}]\t[expr {$i*3}]" } close $f # execsql {--vdbe-trace-on--} execsql {COPY tbl2 FROM './testdata1.txt'} file delete -force ./testdata1.txt } {} do_test select2-2.1 { execsql {SELECT count(*) FROM tbl2} } {30000} do_test select2-2.2 { execsql {SELECT count(*) FROM tbl2 WHERE f2>1000} } {29500} do_test select2-3.1 { execsql {SELECT f1 FROM tbl2 WHERE 1000=f2} } {500} do_test select2-3.2a { execsql {CREATE INDEX idx1 ON tbl2(f2)} } {} do_test select2-3.2b { execsql {SELECT f1 FROM tbl2 WHERE 1000=f2} } {500} do_test select2-3.2c { execsql {SELECT f1 FROM tbl2 WHERE f2=1000} } {500} do_test select2-3.2d { set sqlite_search_count 0 execsql {SELECT * FROM tbl2 WHERE 1000=f2} set sqlite_search_count } {3} do_test select2-3.2e { set sqlite_search_count 0 execsql {SELECT * FROM tbl2 WHERE f2=1000} set sqlite_search_count } {3} # Make sure queries run faster with an index than without # do_test select2-3.3 { execsql {DROP INDEX idx1} set sqlite_search_count 0 execsql {SELECT f1 FROM tbl2 WHERE f2==2000} set sqlite_search_count } {29999} # Make sure we can optimize functions in the WHERE clause that # use fields from two or more different table. (Bug #6) # do_test select2-4.1 { execsql { CREATE TABLE aa(a); CREATE TABLE bb(b); INSERT INTO aa VALUES(1); INSERT INTO aa VALUES(3); INSERT INTO bb VALUES(2); INSERT INTO bb VALUES(4); SELECT * FROM aa, bb WHERE max(a,b)>2; } } {1 4 3 2 3 4} do_test select2-4.2 { execsql { INSERT INTO bb VALUES(0); SELECT * FROM aa, bb WHERE b; } } {1 2 1 4 3 2 3 4} do_test select2-4.3 { execsql { SELECT * FROM aa, bb WHERE NOT b; } } {1 0 3 0} do_test select2-4.4 { execsql { SELECT * FROM aa, bb WHERE min(a,b); } } {1 2 1 4 3 2 3 4} do_test select2-4.5 { execsql { SELECT * FROM aa, bb WHERE NOT min(a,b); } } {1 0 3 0} do_test select2-4.6 { execsql { SELECT * FROM aa, bb WHERE CASE WHEN a=b-1 THEN 1 END; } } {1 2 3 4} do_test select2-4.7 { execsql { SELECT * FROM aa, bb WHERE CASE WHEN a=b-1 THEN 0 ELSE 1 END; } } {1 4 1 0 3 2 3 0} finish_test sqlite-2.8.17/test/fkey1.test0000644000175000001440000000217010232547612015747 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for foreign keys. # set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table and some data to work with. # do_test fkey1-1.0 { execsql { CREATE TABLE t1( a INTEGER PRIMARY KEY, b INTEGER REFERENCES t1 ON DELETE CASCADE REFERENCES t2, c TEXT, FOREIGN KEY (b,c) REFERENCES t2(x,y) ON UPDATE CASCADE ); } } {} do_test fkey1-1.1 { execsql { CREATE TABLE t2( x INTEGER PRIMARY KEY, y TEXT ); } } {} do_test fkey1-1.2 { execsql { CREATE TABLE t3( a INTEGER REFERENCES t2, b INTEGER REFERENCES t1, FOREIGN KEY (a,b) REFERENCES t2(x,y) ); } } {} finish_test sqlite-2.8.17/test/intpkey.test0000644000175000001440000002450110232547612016415 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the special processing associated # with INTEGER PRIMARY KEY columns. # # $Id: intpkey.test,v 1.14 2003/06/15 23:42:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table with a primary key and a datatype other than # integer # do_test intpkey-1.0 { execsql { CREATE TABLE t1(a TEXT PRIMARY KEY, b, c); } } {} # There should be an index associated with the primary key # do_test intpkey-1.1 { execsql { SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='t1'; } } {{(t1 autoindex 1)}} # Now create a table with an integer primary key and verify that # there is no associated index. # do_test intpkey-1.2 { execsql { DROP TABLE t1; CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='t1'; } } {} # Insert some records into the new table. Specify the primary key # and verify that the key is used as the record number. # do_test intpkey-1.3 { execsql { INSERT INTO t1 VALUES(5,'hello','world'); } db last_insert_rowid } {5} do_test intpkey-1.4 { execsql { SELECT * FROM t1; } } {5 hello world} do_test intpkey-1.5 { execsql { SELECT rowid, * FROM t1; } } {5 5 hello world} # Attempting to insert a duplicate primary key should give a constraint # failure. # do_test intpkey-1.6 { set r [catch {execsql { INSERT INTO t1 VALUES(5,'second','entry'); }} msg] lappend r $msg } {1 {PRIMARY KEY must be unique}} do_test intpkey-1.7 { execsql { SELECT rowid, * FROM t1; } } {5 5 hello world} do_test intpkey-1.8 { set r [catch {execsql { INSERT INTO t1 VALUES(6,'second','entry'); }} msg] lappend r $msg } {0 {}} do_test intpkey-1.8.1 { db last_insert_rowid } {6} do_test intpkey-1.9 { execsql { SELECT rowid, * FROM t1; } } {5 5 hello world 6 6 second entry} # A ROWID is automatically generated for new records that do not specify # the integer primary key. # do_test intpkey-1.10 { execsql { INSERT INTO t1(b,c) VALUES('one','two'); SELECT b FROM t1 ORDER BY b; } } {hello one second} # Try to change the ROWID for the new entry. # do_test intpkey-1.11 { execsql { UPDATE t1 SET a=4 WHERE b='one'; SELECT * FROM t1; } } {4 one two 5 hello world 6 second entry} # Make sure SELECT statements are able to use the primary key column # as an index. # do_test intpkey-1.12 { execsql { SELECT * FROM t1 WHERE a==4; } } {4 one two} # Try to insert a non-integer value into the primary key field. This # should result in a data type mismatch. # do_test intpkey-1.13.1 { set r [catch {execsql { INSERT INTO t1 VALUES('x','y','z'); }} msg] lappend r $msg } {1 {datatype mismatch}} do_test intpkey-1.13.2 { set r [catch {execsql { INSERT INTO t1 VALUES('','y','z'); }} msg] lappend r $msg } {1 {datatype mismatch}} do_test intpkey-1.14 { set r [catch {execsql { INSERT INTO t1 VALUES(3.4,'y','z'); }} msg] lappend r $msg } {1 {datatype mismatch}} do_test intpkey-1.15 { set r [catch {execsql { INSERT INTO t1 VALUES(-3,'y','z'); }} msg] lappend r $msg } {0 {}} do_test intpkey-1.16 { execsql {SELECT * FROM t1} } {-3 y z 4 one two 5 hello world 6 second entry} #### INDICES # Check to make sure indices work correctly with integer primary keys # do_test intpkey-2.1 { execsql { CREATE INDEX i1 ON t1(b); SELECT * FROM t1 WHERE b=='y' } } {-3 y z} do_test intpkey-2.1.1 { execsql { SELECT * FROM t1 WHERE b=='y' AND rowid<0 } } {-3 y z} do_test intpkey-2.1.2 { execsql { SELECT * FROM t1 WHERE b=='y' AND rowid<0 AND rowid>=-20 } } {-3 y z} do_test intpkey-2.1.3 { execsql { SELECT * FROM t1 WHERE b>='y' } } {-3 y z} do_test intpkey-2.1.4 { execsql { SELECT * FROM t1 WHERE b>='y' AND rowid<10 } } {-3 y z} do_test intpkey-2.2 { execsql { UPDATE t1 SET a=8 WHERE b=='y'; SELECT * FROM t1 WHERE b=='y'; } } {8 y z} do_test intpkey-2.3 { execsql { SELECT rowid, * FROM t1; } } {4 4 one two 5 5 hello world 6 6 second entry 8 8 y z} do_test intpkey-2.4 { execsql { SELECT rowid, * FROM t1 WHERE b<'second' } } {5 5 hello world 4 4 one two} do_test intpkey-2.4.1 { execsql { SELECT rowid, * FROM t1 WHERE 'second'>b } } {5 5 hello world 4 4 one two} do_test intpkey-2.4.2 { execsql { SELECT rowid, * FROM t1 WHERE 8>rowid AND 'second'>b } } {4 4 one two 5 5 hello world} do_test intpkey-2.4.3 { execsql { SELECT rowid, * FROM t1 WHERE 8>rowid AND 'second'>b AND 0'a' } } {5 5 hello world 4 4 one two 6 6 second entry 8 8 y z} do_test intpkey-2.6 { execsql { DELETE FROM t1 WHERE rowid=4; SELECT * FROM t1 WHERE b>'a'; } } {5 hello world 6 second entry 8 y z} do_test intpkey-2.7 { execsql { UPDATE t1 SET a=-4 WHERE rowid=8; SELECT * FROM t1 WHERE b>'a'; } } {5 hello world 6 second entry -4 y z} do_test intpkey-2.7 { execsql { SELECT * FROM t1 } } {-4 y z 5 hello world 6 second entry} # Do an SQL statement. Append the search count to the end of the result. # proc count sql { set ::sqlite_search_count 0 return [concat [execsql $sql] $::sqlite_search_count] } # Create indices that include the integer primary key as one of their # columns. # do_test intpkey-3.1 { execsql { CREATE INDEX i2 ON t1(a); } } {} do_test intpkey-3.2 { count { SELECT * FROM t1 WHERE a=5; } } {5 hello world 0} do_test intpkey-3.3 { count { SELECT * FROM t1 WHERE a>4 AND a<6; } } {5 hello world 2} do_test intpkey-3.4 { count { SELECT * FROM t1 WHERE b>='hello' AND b<'hello2'; } } {5 hello world 3} do_test intpkey-3.5 { execsql { CREATE INDEX i3 ON t1(c,a); } } {} do_test intpkey-3.6 { count { SELECT * FROM t1 WHERE c=='world'; } } {5 hello world 3} do_test intpkey-3.7 { execsql {INSERT INTO t1 VALUES(11,'hello','world')} count { SELECT * FROM t1 WHERE c=='world'; } } {5 hello world 11 hello world 5} do_test intpkey-3.8 { count { SELECT * FROM t1 WHERE c=='world' AND a>7; } } {11 hello world 5} do_test intpkey-3.9 { count { SELECT * FROM t1 WHERE 7=oid; } } {11 hello world 1} do_test intpkey-4.9 { count { SELECT * FROM t1 WHERE 11<=_rowid_ AND 12>=a; } } {11 hello world 1} do_test intpkey-4.10 { count { SELECT * FROM t1 WHERE 0>=_rowid_; } } {-4 y z 1} do_test intpkey-4.11 { count { SELECT * FROM t1 WHERE a<0; } } {-4 y z 1} do_test intpkey-4.12 { count { SELECT * FROM t1 WHERE a<0 AND a>10; } } {1} # Make sure it is OK to insert a rowid of 0 # do_test intpkey-5.1 { execsql { INSERT INTO t1 VALUES(0,'zero','entry'); } count { SELECT * FROM t1 WHERE a=0; } } {0 zero entry 0} do_test intpkey=5.2 { execsql { SELECT rowid, a FROM t1 } } {-4 -4 0 0 5 5 6 6 11 11} # Test the ability of the COPY command to put data into a # table that contains an integer primary key. # do_test intpkey-6.1 { set f [open ./data1.txt w] puts $f "20\tb-20\tc-20" puts $f "21\tb-21\tc-21" puts $f "22\tb-22\tc-22" close $f execsql { COPY t1 FROM 'data1.txt'; SELECT * FROM t1 WHERE a>=20; } } {20 b-20 c-20 21 b-21 c-21 22 b-22 c-22} do_test intpkey-6.2 { execsql { SELECT * FROM t1 WHERE b=='hello' } } {5 hello world 11 hello world} do_test intpkey-6.3 { execsql { DELETE FROM t1 WHERE b='b-21'; SELECT * FROM t1 WHERE b=='b-21'; } } {} do_test intpkey-6.4 { execsql { SELECT * FROM t1 WHERE a>=20 } } {20 b-20 c-20 22 b-22 c-22} # Do an insert of values with the columns specified out of order. # do_test intpkey-7.1 { execsql { INSERT INTO t1(c,b,a) VALUES('row','new',30); SELECT * FROM t1 WHERE rowid>=30; } } {30 new row} do_test intpkey-7.2 { execsql { SELECT * FROM t1 WHERE rowid>20; } } {22 b-22 c-22 30 new row} # Do an insert from a select statement. # do_test intpkey-8.1 { execsql { CREATE TABLE t2(x INTEGER PRIMARY KEY, y, z); INSERT INTO t2 SELECT * FROM t1; SELECT rowid FROM t2; } } {-4 0 5 6 11 20 22 30} do_test intpkey-8.2 { execsql { SELECT x FROM t2; } } {-4 0 5 6 11 20 22 30} do_test intpkey-9.1 { execsql { UPDATE t1 SET c='www' WHERE c='world'; SELECT rowid, a, c FROM t1 WHERE c=='www'; } } {5 5 www 11 11 www} # Check insert of NULL for primary key # do_test intpkey-10.1 { execsql { DROP TABLE t2; CREATE TABLE t2(x INTEGER PRIMARY KEY, y, z); INSERT INTO t2 VALUES(NULL, 1, 2); SELECT * from t2; } } {1 1 2} do_test intpkey-10.2 { execsql { INSERT INTO t2 VALUES(NULL, 2, 3); SELECT * from t2 WHERE x=2; } } {2 2 3} do_test intpkey-10.3 { execsql { INSERT INTO t2 SELECT NULL, z, y FROM t2; SELECT * FROM t2; } } {1 1 2 2 2 3 3 2 1 4 3 2} # This tests checks to see if a floating point number can be used # to reference an integer primary key. # do_test intpkey-11.1 { execsql { SELECT b FROM t1 WHERE a=2.0+3.0; } } {hello} do_test intpkey-11.1 { execsql { SELECT b FROM t1 WHERE a=2.0+3.5; } } {} integrity_check intpkey-12.1 finish_test sqlite-2.8.17/test/select3.test0000644000175000001440000001356410232547612016303 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing aggregate functions and the # GROUP BY and HAVING clauses of SELECT statements. # # $Id: select3.test,v 1.8 2003/01/31 17:16:37 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # do_test select3-1.0 { set fd [open data1.txt w] for {set i 1} {$i<32} {incr i} { for {set j 0} {pow(2,$j)<$i} {incr j} {} puts $fd "$i\t$j" } close $fd execsql { CREATE TABLE t1(n int, log int); COPY t1 FROM 'data1.txt' } file delete data1.txt execsql {SELECT DISTINCT log FROM t1 ORDER BY log} } {0 1 2 3 4 5} # Basic aggregate functions. # do_test select3-1.1 { execsql {SELECT count(*) FROM t1} } {31} do_test select3-1.2 { execsql { SELECT min(n),min(log),max(n),max(log),sum(n),sum(log),avg(n),avg(log) FROM t1 } } {1 0 31 5 496 124 16 4} do_test select3-1.3 { execsql {SELECT max(n)/avg(n), max(log)/avg(log) FROM t1} } {1.9375 1.25} # Try some basic GROUP BY clauses # do_test select3-2.1 { execsql {SELECT log, count(*) FROM t1 GROUP BY log ORDER BY log} } {0 1 1 1 2 2 3 4 4 8 5 15} do_test select3-2.2 { execsql {SELECT log, min(n) FROM t1 GROUP BY log ORDER BY log} } {0 1 1 2 2 3 3 5 4 9 5 17} do_test select3-2.3 { execsql {SELECT log, avg(n) FROM t1 GROUP BY log ORDER BY log} } {0 1 1 2 2 3.5 3 6.5 4 12.5 5 24} do_test select3-2.3 { execsql {SELECT log, avg(n)+1 FROM t1 GROUP BY log ORDER BY log} } {0 2 1 3 2 4.5 3 7.5 4 13.5 5 25} do_test select3-2.4 { execsql {SELECT log, avg(n)-min(n) FROM t1 GROUP BY log ORDER BY log} } {0 0 1 0 2 0.5 3 1.5 4 3.5 5 7} do_test select3-2.5 { execsql {SELECT log*2+1, avg(n)-min(n) FROM t1 GROUP BY log ORDER BY log} } {1 0 3 0 5 0.5 7 1.5 9 3.5 11 7} do_test select3-2.6 { execsql { SELECT log*2+1 as x, count(*) FROM t1 GROUP BY x ORDER BY x } } {1 1 3 1 5 2 7 4 9 8 11 15} do_test select3-2.7 { execsql { SELECT log*2+1 AS x, count(*) AS y FROM t1 GROUP BY x ORDER BY y } } {1 1 3 1 5 2 7 4 9 8 11 15} do_test select3-2.8 { execsql { SELECT log*2+1 AS x, count(*) AS y FROM t1 GROUP BY x ORDER BY 10-(x+y) } } {11 15 9 8 7 4 5 2 3 1 1 1} do_test select3-2.9 { catchsql { SELECT log, count(*) FROM t1 GROUP BY 'x' ORDER BY log; } } {1 {GROUP BY terms must not be non-integer constants}} do_test select3-2.10 { catchsql { SELECT log, count(*) FROM t1 GROUP BY 0 ORDER BY log; } } {1 {GROUP BY column number 0 out of range - should be between 1 and 2}} do_test select3-2.11 { catchsql { SELECT log, count(*) FROM t1 GROUP BY 3 ORDER BY log; } } {1 {GROUP BY column number 3 out of range - should be between 1 and 2}} do_test select3-2.12 { catchsql { SELECT log, count(*) FROM t1 GROUP BY 1 ORDER BY log; } } {0 {0 1 1 1 2 2 3 4 4 8 5 15}} #do_test select3-2.13 { # catchsql { # SELECT log, count(*) FROM t1 GROUP BY 2 ORDER BY log; # } #} {0 {0 1 1 1 2 2 3 4 4 8 5 15}} #do_test select3-2.14 { # catchsql { # SELECT log, count(*) FROM t1 GROUP BY count(*) ORDER BY log; # } #} {0 {0 1 1 1 2 2 3 4 4 8 5 15}} # Cannot have a HAVING without a GROUP BY # do_test select3-3.1 { set v [catch {execsql {SELECT log, count(*) FROM t1 HAVING log>=4}} msg] lappend v $msg } {1 {a GROUP BY clause is required before HAVING}} # Toss in some HAVING clauses # do_test select3-4.1 { execsql {SELECT log, count(*) FROM t1 GROUP BY log HAVING log>=4 ORDER BY log} } {4 8 5 15} do_test select3-4.2 { execsql { SELECT log, count(*) FROM t1 GROUP BY log HAVING count(*)>=4 ORDER BY log } } {3 4 4 8 5 15} do_test select3-4.3 { execsql { SELECT log, count(*) FROM t1 GROUP BY log HAVING count(*)>=4 ORDER BY max(n) } } {3 4 4 8 5 15} do_test select3-4.4 { execsql { SELECT log AS x, count(*) AS y FROM t1 GROUP BY x HAVING y>=4 ORDER BY max(n) } } {3 4 4 8 5 15} do_test select3-4.5 { execsql { SELECT log AS x FROM t1 GROUP BY x HAVING count(*)>=4 ORDER BY max(n) } } {3 4 5} do_test select3-5.1 { execsql { SELECT log, count(*), avg(n), max(n+log*2) FROM t1 GROUP BY log ORDER BY max(n+log*2), avg(n) } } {0 1 1 1 1 1 2 4 2 2 3.5 8 3 4 6.5 14 4 8 12.5 24 5 15 24 41} do_test select3-5.2 { execsql { SELECT log, count(*), avg(n), max(n+log*2) FROM t1 GROUP BY log ORDER BY max(n+log*2), min(log,avg(n)) } } {0 1 1 1 1 1 2 4 2 2 3.5 8 3 4 6.5 14 4 8 12.5 24 5 15 24 41} # Test sorting of GROUP BY results in the presence of an index # on the GROUP BY column. # do_test select3-6.1 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY log; } } {0 1 1 2 2 3 3 5 4 9 5 17} do_test select3-6.2 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY log DESC; } } {5 17 4 9 3 5 2 3 1 2 0 1} do_test select3-6.3 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY 1; } } {0 1 1 2 2 3 3 5 4 9 5 17} do_test select3-6.4 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY 1 DESC; } } {5 17 4 9 3 5 2 3 1 2 0 1} do_test select3-6.5 { execsql { CREATE INDEX i1 ON t1(log); SELECT log, min(n) FROM t1 GROUP BY log ORDER BY log; } } {0 1 1 2 2 3 3 5 4 9 5 17} do_test select3-6.6 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY log DESC; } } {5 17 4 9 3 5 2 3 1 2 0 1} do_test select3-6.7 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY 1; } } {0 1 1 2 2 3 3 5 4 9 5 17} do_test select3-6.8 { execsql { SELECT log, min(n) FROM t1 GROUP BY log ORDER BY 1 DESC; } } {5 17 4 9 3 5 2 3 1 2 0 1} finish_test sqlite-2.8.17/test/func.test0000644000175000001440000002341310232547612015666 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing built-in functions. # # $Id: func.test,v 1.16.2.2 2004/07/18 21:14:05 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table to work with. # do_test func-0.0 { execsql {CREATE TABLE tbl1(t1 text)} foreach word {this program is free software} { execsql "INSERT INTO tbl1 VALUES('$word')" } execsql {SELECT t1 FROM tbl1 ORDER BY t1} } {free is program software this} do_test func-0.1 { execsql { CREATE TABLE t2(a); INSERT INTO t2 VALUES(1); INSERT INTO t2 VALUES(NULL); INSERT INTO t2 VALUES(345); INSERT INTO t2 VALUES(NULL); INSERT INTO t2 VALUES(67890); SELECT * FROM t2; } } {1 {} 345 {} 67890} # Check out the length() function # do_test func-1.0 { execsql {SELECT length(t1) FROM tbl1 ORDER BY t1} } {4 2 7 8 4} do_test func-1.1 { set r [catch {execsql {SELECT length(*) FROM tbl1 ORDER BY t1}} msg] lappend r $msg } {1 {wrong number of arguments to function length()}} do_test func-1.2 { set r [catch {execsql {SELECT length(t1,5) FROM tbl1 ORDER BY t1}} msg] lappend r $msg } {1 {wrong number of arguments to function length()}} do_test func-1.3 { execsql {SELECT length(t1), count(*) FROM tbl1 GROUP BY length(t1) ORDER BY length(t1)} } {2 1 4 2 7 1 8 1} do_test func-1.4 { execsql {SELECT coalesce(length(a),-1) FROM t2} } {1 -1 3 -1 5} # Check out the substr() function # do_test func-2.0 { execsql {SELECT substr(t1,1,2) FROM tbl1 ORDER BY t1} } {fr is pr so th} do_test func-2.1 { execsql {SELECT substr(t1,2,1) FROM tbl1 ORDER BY t1} } {r s r o h} do_test func-2.2 { execsql {SELECT substr(t1,3,3) FROM tbl1 ORDER BY t1} } {ee {} ogr ftw is} do_test func-2.3 { execsql {SELECT substr(t1,-1,1) FROM tbl1 ORDER BY t1} } {e s m e s} do_test func-2.4 { execsql {SELECT substr(t1,-1,2) FROM tbl1 ORDER BY t1} } {e s m e s} do_test func-2.5 { execsql {SELECT substr(t1,-2,1) FROM tbl1 ORDER BY t1} } {e i a r i} do_test func-2.6 { execsql {SELECT substr(t1,-2,2) FROM tbl1 ORDER BY t1} } {ee is am re is} do_test func-2.7 { execsql {SELECT substr(t1,-4,2) FROM tbl1 ORDER BY t1} } {fr {} gr wa th} do_test func-2.8 { execsql {SELECT t1 FROM tbl1 ORDER BY substr(t1,2,20)} } {this software free program is} do_test func-2.9 { execsql {SELECT substr(a,1,1) FROM t2} } {1 {} 3 {} 6} do_test func-2.10 { execsql {SELECT substr(a,2,2) FROM t2} } {{} {} 45 {} 78} # Only do the following tests if TCL has UTF-8 capabilities and # the UTF-8 encoding is turned on in the SQLite library. # if {[sqlite -encoding]=="UTF-8" && "\u1234"!="u1234"} { # Put some UTF-8 characters in the database # do_test func-3.0 { execsql {DELETE FROM tbl1} foreach word "contains UTF-8 characters hi\u1234ho" { execsql "INSERT INTO tbl1 VALUES('$word')" } execsql {SELECT t1 FROM tbl1 ORDER BY t1} } "UTF-8 characters contains hi\u1234ho" do_test func-3.1 { execsql {SELECT length(t1) FROM tbl1 ORDER BY t1} } {5 10 8 5} do_test func-3.2 { execsql {SELECT substr(t1,1,2) FROM tbl1 ORDER BY t1} } {UT ch co hi} do_test func-3.3 { execsql {SELECT substr(t1,1,3) FROM tbl1 ORDER BY t1} } "UTF cha con hi\u1234" do_test func-3.4 { execsql {SELECT substr(t1,2,2) FROM tbl1 ORDER BY t1} } "TF ha on i\u1234" do_test func-3.5 { execsql {SELECT substr(t1,2,3) FROM tbl1 ORDER BY t1} } "TF- har ont i\u1234h" do_test func-3.6 { execsql {SELECT substr(t1,3,2) FROM tbl1 ORDER BY t1} } "F- ar nt \u1234h" do_test func-3.7 { execsql {SELECT substr(t1,4,2) FROM tbl1 ORDER BY t1} } "-8 ra ta ho" do_test func-3.8 { execsql {SELECT substr(t1,-1,1) FROM tbl1 ORDER BY t1} } "8 s s o" do_test func-3.9 { execsql {SELECT substr(t1,-3,2) FROM tbl1 ORDER BY t1} } "F- er in \u1234h" do_test func-3.10 { execsql {SELECT substr(t1,-4,3) FROM tbl1 ORDER BY t1} } "TF- ter ain i\u1234h" do_test func-3.99 { execsql {DELETE FROM tbl1} foreach word {this program is free software} { execsql "INSERT INTO tbl1 VALUES('$word')" } execsql {SELECT t1 FROM tbl1} } {this program is free software} } ;# End [sqlite -encoding]==UTF-8 and \u1234!=u1234 # Test the abs() and round() functions. # do_test func-4.1 { execsql { CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(2,1.2345678901234,-12345.67890); INSERT INTO t1 VALUES(3,-2,-5); } catchsql {SELECT abs(a,b) FROM t1} } {1 {wrong number of arguments to function abs()}} do_test func-4.2 { catchsql {SELECT abs() FROM t1} } {1 {wrong number of arguments to function abs()}} do_test func-4.3 { catchsql {SELECT abs(b) FROM t1 ORDER BY a} } {0 {2 1.2345678901234 2}} do_test func-4.4 { catchsql {SELECT abs(c) FROM t1 ORDER BY a} } {0 {3 12345.67890 5}} do_test func-4.4.1 { execsql {SELECT abs(a) FROM t2} } {1 {} 345 {} 67890} do_test func-4.4.2 { execsql {SELECT abs(t1) FROM tbl1} } {this program is free software} do_test func-4.5 { catchsql {SELECT round(a,b,c) FROM t1} } {1 {wrong number of arguments to function round()}} do_test func-4.6 { catchsql {SELECT round(b,2) FROM t1 ORDER BY b} } {0 {-2.00 1.23 2.00}} do_test func-4.7 { catchsql {SELECT round(b,0) FROM t1 ORDER BY a} } {0 {2 1 -2}} do_test func-4.8 { catchsql {SELECT round(c) FROM t1 ORDER BY a} } {0 {3 -12346 -5}} do_test func-4.9 { catchsql {SELECT round(c,a) FROM t1 ORDER BY a} } {0 {3.0 -12345.68 -5.000}} do_test func-4.10 { catchsql {SELECT 'x' || round(c,a) || 'y' FROM t1 ORDER BY a} } {0 {x3.0y x-12345.68y x-5.000y}} do_test func-4.11 { catchsql {SELECT round() FROM t1 ORDER BY a} } {1 {wrong number of arguments to function round()}} do_test func-4.12 { execsql {SELECT coalesce(round(a,2),'nil') FROM t2} } {1.00 nil 345.00 nil 67890.00} do_test func-4.13 { execsql {SELECT round(t1,2) FROM tbl1} } {0.00 0.00 0.00 0.00 0.00} # Test the upper() and lower() functions # do_test func-5.1 { execsql {SELECT upper(t1) FROM tbl1} } {THIS PROGRAM IS FREE SOFTWARE} do_test func-5.2 { execsql {SELECT lower(upper(t1)) FROM tbl1} } {this program is free software} do_test func-5.3 { execsql {SELECT upper(a), lower(a) FROM t2} } {1 1 {} {} 345 345 {} {} 67890 67890} do_test func-5.4 { catchsql {SELECT upper(a,5) FROM t2} } {1 {wrong number of arguments to function upper()}} do_test func-5.5 { catchsql {SELECT upper(*) FROM t2} } {1 {wrong number of arguments to function upper()}} # Test the coalesce() and nullif() functions # do_test func-6.1 { execsql {SELECT coalesce(a,'xyz') FROM t2} } {1 xyz 345 xyz 67890} do_test func-6.2 { execsql {SELECT coalesce(upper(a),'nil') FROM t2} } {1 nil 345 nil 67890} do_test func-6.3 { execsql {SELECT coalesce(nullif(1,1),'nil')} } {nil} do_test func-6.4 { execsql {SELECT coalesce(nullif(1,2),'nil')} } {1} do_test func-6.5 { execsql {SELECT coalesce(nullif(1,NULL),'nil')} } {1} # Test the last_insert_rowid() function # do_test func-7.1 { execsql {SELECT last_insert_rowid()} } [db last_insert_rowid] # Tests for aggregate functions and how they handle NULLs. # do_test func-8.1 { execsql { SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2; } } {68236 3 22745.33 1 67890 5} do_test func-8.2 { execsql { SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2; } } {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} do_test func-8.3 { execsql { CREATE TEMP TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC; SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3; } } {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} do_test func-8.4 { execsql { SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3; } } {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} # How do you test the random() function in a meaningful, deterministic way? # do_test func-9.1 { execsql { SELECT random() is not null; } } {1} # Use the "sqlite_register_test_function" TCL command which is part of # the text fixture in order to verify correct operation of some of # the user-defined SQL function APIs that are not used by the built-in # functions. # db close set ::DB [sqlite db test.db] sqlite_register_test_function $::DB testfunc do_test func-10.1 { catchsql { SELECT testfunc(NULL,NULL); } } {1 {first argument to test function may not be NULL}} do_test func-10.2 { execsql { SELECT testfunc( 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'int', 1234 ); } } {1234} do_test func-10.3 { execsql { SELECT testfunc( 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'string', NULL ); } } {{}} do_test func-10.4 { execsql { SELECT testfunc( 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'double', 1.234 ); } } {1.234} do_test func-10.5 { execsql { SELECT testfunc( 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'int', 1234, 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'string', NULL, 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'double', 1.234, 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'int', 1234, 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'string', NULL, 'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'double', 1.234 ); } } {1.234} # Test the built-in sqlite_version(*) SQL function. # do_test func-11.1 { execsql { SELECT sqlite_version(*); } } [sqlite -version] finish_test sqlite-2.8.17/test/join.test0000644000175000001440000002354210232547612015675 0ustar drhusers00000000000000# 2002 May 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for joins, including outer joins. # # $Id: join.test,v 1.11 2003/09/27 13:39:40 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test join-1.1 { execsql { CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(2,3,4); INSERT INTO t1 VALUES(3,4,5); SELECT * FROM t1; } } {1 2 3 2 3 4 3 4 5} do_test join-1.2 { execsql { CREATE TABLE t2(b,c,d); INSERT INTO t2 VALUES(1,2,3); INSERT INTO t2 VALUES(2,3,4); INSERT INTO t2 VALUES(3,4,5); SELECT * FROM t2; } } {1 2 3 2 3 4 3 4 5} do_test join-1.3 { execsql2 { SELECT * FROM t1 NATURAL JOIN t2; } } {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5} do_test join-1.3.1 { execsql2 { SELECT * FROM t2 NATURAL JOIN t1; } } {t2.b 2 t2.c 3 t2.d 4 t1.a 1 t2.b 3 t2.c 4 t2.d 5 t1.a 2} do_test join-1.4 { execsql2 { SELECT * FROM t1 INNER JOIN t2 USING(b,c); } } {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5} do_test join-1.5 { execsql2 { SELECT * FROM t1 INNER JOIN t2 USING(b); } } {t1.a 1 t1.b 2 t1.c 3 t2.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.c 4 t2.d 5} do_test join-1.6 { execsql2 { SELECT * FROM t1 INNER JOIN t2 USING(c); } } {t1.a 1 t1.b 2 t1.c 3 t2.b 2 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.b 3 t2.d 5} do_test join-1.7 { execsql2 { SELECT * FROM t1 INNER JOIN t2 USING(c,b); } } {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5} do_test join-1.8 { execsql { SELECT * FROM t1 NATURAL CROSS JOIN t2; } } {1 2 3 4 2 3 4 5} do_test join-1.9 { execsql { SELECT * FROM t1 CROSS JOIN t2 USING(b,c); } } {1 2 3 4 2 3 4 5} do_test join-1.10 { execsql { SELECT * FROM t1 NATURAL INNER JOIN t2; } } {1 2 3 4 2 3 4 5} do_test join-1.11 { execsql { SELECT * FROM t1 INNER JOIN t2 USING(b,c); } } {1 2 3 4 2 3 4 5} do_test join-1.12 { execsql { SELECT * FROM t1 natural inner join t2; } } {1 2 3 4 2 3 4 5} do_test join-1.13 { execsql2 { SELECT * FROM t1 NATURAL JOIN (SELECT b as 'c', c as 'd', d as 'e' FROM t2) as t3 } } {t1.a 1 t1.b 2 t1.c 3 t3.d 4 t3.e 5} do_test join-1.14 { execsql2 { SELECT * FROM (SELECT b as 'c', c as 'd', d as 'e' FROM t2) as 'tx' NATURAL JOIN t1 } } {tx.c 3 tx.d 4 tx.e 5 t1.a 1 t1.b 2} do_test join-1.15 { execsql { CREATE TABLE t3(c,d,e); INSERT INTO t3 VALUES(2,3,4); INSERT INTO t3 VALUES(3,4,5); INSERT INTO t3 VALUES(4,5,6); SELECT * FROM t3; } } {2 3 4 3 4 5 4 5 6} do_test join-1.16 { execsql { SELECT * FROM t1 natural join t2 natural join t3; } } {1 2 3 4 5 2 3 4 5 6} do_test join-1.17 { execsql2 { SELECT * FROM t1 natural join t2 natural join t3; } } {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t3.e 5 t1.a 2 t1.b 3 t1.c 4 t2.d 5 t3.e 6} do_test join-1.18 { execsql { CREATE TABLE t4(d,e,f); INSERT INTO t4 VALUES(2,3,4); INSERT INTO t4 VALUES(3,4,5); INSERT INTO t4 VALUES(4,5,6); SELECT * FROM t4; } } {2 3 4 3 4 5 4 5 6} do_test join-1.19 { execsql { SELECT * FROM t1 natural join t2 natural join t4; } } {1 2 3 4 5 6} do_test join-1.19 { execsql2 { SELECT * FROM t1 natural join t2 natural join t4; } } {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t4.e 5 t4.f 6} do_test join-1.20 { execsql { SELECT * FROM t1 natural join t2 natural join t3 WHERE t1.a=1 } } {1 2 3 4 5} do_test join-2.1 { execsql { SELECT * FROM t1 NATURAL LEFT JOIN t2; } } {1 2 3 4 2 3 4 5 3 4 5 {}} do_test join-2.2 { execsql { SELECT * FROM t2 NATURAL LEFT OUTER JOIN t1; } } {1 2 3 {} 2 3 4 1 3 4 5 2} do_test join-2.3 { catchsql { SELECT * FROM t1 NATURAL RIGHT OUTER JOIN t2; } } {1 {RIGHT and FULL OUTER JOINs are not currently supported}} do_test join-2.4 { execsql { SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.d } } {1 2 3 {} {} {} 2 3 4 {} {} {} 3 4 5 1 2 3} do_test join-2.5 { execsql { SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.d WHERE t1.a>1 } } {2 3 4 {} {} {} 3 4 5 1 2 3} do_test join-2.6 { execsql { SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.d WHERE t2.b IS NULL OR t2.b>1 } } {1 2 3 {} {} {} 2 3 4 {} {} {}} do_test join-3.1 { catchsql { SELECT * FROM t1 NATURAL JOIN t2 ON t1.a=t2.b; } } {1 {a NATURAL join may not have an ON or USING clause}} do_test join-3.2 { catchsql { SELECT * FROM t1 NATURAL JOIN t2 USING(b); } } {1 {a NATURAL join may not have an ON or USING clause}} do_test join-3.3 { catchsql { SELECT * FROM t1 JOIN t2 ON t1.a=t2.b USING(b); } } {1 {cannot have both ON and USING clauses in the same join}} do_test join-3.4 { catchsql { SELECT * FROM t1 JOIN t2 USING(a); } } {1 {cannot join using column a - column not present in both tables}} do_test join-3.5 { catchsql { SELECT * FROM t1 USING(a); } } {0 {1 2 3 2 3 4 3 4 5}} do_test join-3.6 { catchsql { SELECT * FROM t1 JOIN t2 ON t3.a=t2.b; } } {1 {no such column: t3.a}} do_test join-3.7 { catchsql { SELECT * FROM t1 INNER OUTER JOIN t2; } } {1 {unknown or unsupported join type: INNER OUTER}} do_test join-3.7 { catchsql { SELECT * FROM t1 LEFT BOGUS JOIN t2; } } {1 {unknown or unsupported join type: LEFT BOGUS}} do_test join-4.1 { execsql { BEGIN; CREATE TABLE t5(a INTEGER PRIMARY KEY); CREATE TABLE t6(a INTEGER); INSERT INTO t6 VALUES(NULL); INSERT INTO t6 VALUES(NULL); INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; COMMIT; } execsql { SELECT * FROM t6 NATURAL JOIN t5; } } {} do_test join-4.2 { execsql { SELECT * FROM t6, t5 WHERE t6.at5.a; } } {} do_test join-4.4 { execsql { UPDATE t6 SET a='xyz'; SELECT * FROM t6 NATURAL JOIN t5; } } {} do_test join-4.6 { execsql { SELECT * FROM t6, t5 WHERE t6.at5.a; } } {} do_test join-4.8 { execsql { UPDATE t6 SET a=1; SELECT * FROM t6 NATURAL JOIN t5; } } {} do_test join-4.9 { execsql { SELECT * FROM t6, t5 WHERE t6.at5.a; } } {} do_test join-5.1 { execsql { BEGIN; create table centros (id integer primary key, centro); INSERT INTO centros VALUES(1,'xxx'); create table usuarios (id integer primary key, nombre, apellidos, idcentro integer); INSERT INTO usuarios VALUES(1,'a','aa',1); INSERT INTO usuarios VALUES(2,'b','bb',1); INSERT INTO usuarios VALUES(3,'c','cc',NULL); create index idcentro on usuarios (idcentro); END; select usuarios.id, usuarios.nombre, centros.centro from usuarios left outer join centros on usuarios.idcentro = centros.id; } } {1 a xxx 2 b xxx 3 c {}} # A test for ticket #247. # do_test join-7.1 { execsql { CREATE TABLE t7 (x, y); INSERT INTO t7 VALUES ("pa1", 1); INSERT INTO t7 VALUES ("pa2", NULL); INSERT INTO t7 VALUES ("pa3", NULL); INSERT INTO t7 VALUES ("pa4", 2); INSERT INTO t7 VALUES ("pa30", 131); INSERT INTO t7 VALUES ("pa31", 130); INSERT INTO t7 VALUES ("pa28", NULL); CREATE TABLE t8 (a integer primary key, b); INSERT INTO t8 VALUES (1, "pa1"); INSERT INTO t8 VALUES (2, "pa4"); INSERT INTO t8 VALUES (3, NULL); INSERT INTO t8 VALUES (4, NULL); INSERT INTO t8 VALUES (130, "pa31"); INSERT INTO t8 VALUES (131, "pa30"); SELECT coalesce(t8.a,999) from t7 LEFT JOIN t8 on y=a; } } {1 999 999 2 131 130 999} # Make sure a left join where the right table is really a view that # is itself a join works right. Ticket #306. # do_test join-8.1 { execsql { BEGIN; CREATE TABLE t9(a INTEGER PRIMARY KEY, b); INSERT INTO t9 VALUES(1,11); INSERT INTO t9 VALUES(2,22); CREATE TABLE t10(x INTEGER PRIMARY KEY, y); INSERT INTO t10 VALUES(1,2); INSERT INTO t10 VALUES(3,3); CREATE TABLE t11(p INTEGER PRIMARY KEY, q); INSERT INTO t11 VALUES(2,111); INSERT INTO t11 VALUES(3,333); CREATE VIEW v10_11 AS SELECT x, q FROM t10, t11 WHERE t10.y=t11.p; COMMIT; SELECT * FROM t9 LEFT JOIN v10_11 ON( a=x ); } } {1 11 1 111 2 22 {} {}} do_test join-8.2 { execsql { SELECT * FROM t9 LEFT JOIN (SELECT x, q FROM t10, t11 WHERE t10.y=t11.p) ON( a=x); } } {1 11 1 111 2 22 {} {}} do_test join-8.3 { execsql { SELECT * FROM v10_11 LEFT JOIN t9 ON( a=x ); } } {1 111 1 11 3 333 {} {}} # Ticket #350 describes a scenario where LEFT OUTER JOIN does not # function correctly if the right table in the join is really # subquery. # # To test the problem, we generate the same LEFT OUTER JOIN in two # separate selects but with on using a subquery and the other calling # the table directly. Then connect the two SELECTs using an EXCEPT. # Both queries should generate the same results so the answer should # be an empty set. # do_test join-9.1 { execsql { BEGIN; CREATE TABLE t12(a,b); INSERT INTO t12 VALUES(1,11); INSERT INTO t12 VALUES(2,22); CREATE TABLE t13(b,c); INSERT INTO t13 VALUES(22,222); COMMIT; SELECT * FROM t12 NATURAL LEFT JOIN t13 EXCEPT SELECT * FROM t12 NATURAL LEFT JOIN (SELECT * FROM t13 WHERE b>0); } } {} do_test join-9.2 { execsql { CREATE VIEW v13 AS SELECT * FROM t13 WHERE b>0; SELECT * FROM t12 NATURAL LEFT JOIN t13 EXCEPT SELECT * FROM t12 NATURAL LEFT JOIN v13; } } {} finish_test sqlite-2.8.17/test/select4.test0000644000175000001440000002605510232547612016303 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing UNION, INTERSECT and EXCEPT operators # in SELECT statements. # # $Id: select4.test,v 1.13 2003/02/02 12:41:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # set fd [open data1.txt w] for {set i 1} {$i<32} {incr i} { for {set j 0} {pow(2,$j)<$i} {incr j} {} puts $fd "$i\t$j" } close $fd execsql { CREATE TABLE t1(n int, log int); COPY t1 FROM 'data1.txt' } file delete data1.txt do_test select4-1.0 { execsql {SELECT DISTINCT log FROM t1 ORDER BY log} } {0 1 2 3 4 5} # Union All operator # do_test select4-1.1a { lsort [execsql {SELECT DISTINCT log FROM t1}] } {0 1 2 3 4 5} do_test select4-1.1b { lsort [execsql {SELECT n FROM t1 WHERE log=3}] } {5 6 7 8} do_test select4-1.1c { execsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; } } {0 1 2 3 4 5 5 6 7 8} do_test select4-1.1d { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; SELECT * FROM t2; } } {0 1 2 3 4 5 5 6 7 8} execsql {DROP TABLE t2} do_test select4-1.1e { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log DESC; SELECT * FROM t2; } } {8 7 6 5 5 4 3 2 1 0} execsql {DROP TABLE t2} do_test select4-1.1f { execsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=2 } } {0 1 2 3 4 5 3 4} do_test select4-1.1g { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=2; SELECT * FROM t2; } } {0 1 2 3 4 5 3 4} execsql {DROP TABLE t2} do_test select4-1.2 { execsql { SELECT log FROM t1 WHERE n IN (SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3) ORDER BY log; } } {0 1 2 2 3 3 3 3} do_test select4-1.3 { set v [catch {execsql { SELECT DISTINCT log FROM t1 ORDER BY log UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION ALL not before}} # Union operator # do_test select4-2.1 { execsql { SELECT DISTINCT log FROM t1 UNION SELECT n FROM t1 WHERE log=3 ORDER BY log; } } {0 1 2 3 4 5 6 7 8} do_test select4-2.2 { execsql { SELECT log FROM t1 WHERE n IN (SELECT DISTINCT log FROM t1 UNION SELECT n FROM t1 WHERE log=3) ORDER BY log; } } {0 1 2 2 3 3 3 3} do_test select4-2.3 { set v [catch {execsql { SELECT DISTINCT log FROM t1 ORDER BY log UNION SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION not before}} # Except operator # do_test select4-3.1.1 { execsql { SELECT DISTINCT log FROM t1 EXCEPT SELECT n FROM t1 WHERE log=3 ORDER BY log; } } {0 1 2 3 4} do_test select4-3.1.2 { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 EXCEPT SELECT n FROM t1 WHERE log=3 ORDER BY log; SELECT * FROM t2; } } {0 1 2 3 4} execsql {DROP TABLE t2} do_test select4-3.1.3 { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 EXCEPT SELECT n FROM t1 WHERE log=3 ORDER BY log DESC; SELECT * FROM t2; } } {4 3 2 1 0} execsql {DROP TABLE t2} do_test select4-3.2 { execsql { SELECT log FROM t1 WHERE n IN (SELECT DISTINCT log FROM t1 EXCEPT SELECT n FROM t1 WHERE log=3) ORDER BY log; } } {0 1 2 2} do_test select4-3.3 { set v [catch {execsql { SELECT DISTINCT log FROM t1 ORDER BY log EXCEPT SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after EXCEPT not before}} # Intersect operator # do_test select4-4.1.1 { execsql { SELECT DISTINCT log FROM t1 INTERSECT SELECT n FROM t1 WHERE log=3 ORDER BY log; } } {5} do_test select4-4.1.2 { execsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT 6 INTERSECT SELECT n FROM t1 WHERE log=3 ORDER BY log; } } {5 6} do_test select4-4.1.3 { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 UNION ALL SELECT 6 INTERSECT SELECT n FROM t1 WHERE log=3 ORDER BY log; SELECT * FROM t2; } } {5 6} execsql {DROP TABLE t2} do_test select4-4.1.4 { execsql { CREATE TABLE t2 AS SELECT DISTINCT log FROM t1 UNION ALL SELECT 6 INTERSECT SELECT n FROM t1 WHERE log=3 ORDER BY log DESC; SELECT * FROM t2; } } {6 5} execsql {DROP TABLE t2} do_test select4-4.2 { execsql { SELECT log FROM t1 WHERE n IN (SELECT DISTINCT log FROM t1 INTERSECT SELECT n FROM t1 WHERE log=3) ORDER BY log; } } {3} do_test select4-4.3 { set v [catch {execsql { SELECT DISTINCT log FROM t1 ORDER BY log INTERSECT SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after INTERSECT not before}} # Various error messages while processing UNION or INTERSECT # do_test select4-5.1 { set v [catch {execsql { SELECT DISTINCT log FROM t2 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {no such table: t2}} do_test select4-5.2 { set v [catch {execsql { SELECT DISTINCT log AS "xyzzy" FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY xyzzy; }} msg] lappend v $msg } {0 {0 1 2 3 4 5 5 6 7 8}} do_test select4-5.2b { set v [catch {execsql { SELECT DISTINCT log AS xyzzy FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY 'xyzzy'; }} msg] lappend v $msg } {0 {0 1 2 3 4 5 5 6 7 8}} do_test select4-5.2c { set v [catch {execsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY 'xyzzy'; }} msg] lappend v $msg } {1 {ORDER BY term number 1 does not match any result column}} do_test select4-5.2d { set v [catch {execsql { SELECT DISTINCT log FROM t1 INTERSECT SELECT n FROM t1 WHERE log=3 ORDER BY 'xyzzy'; }} msg] lappend v $msg } {1 {ORDER BY term number 1 does not match any result column}} do_test select4-5.2e { set v [catch {execsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY n; }} msg] lappend v $msg } {0 {0 1 2 3 4 5 5 6 7 8}} do_test select4-5.2f { catchsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; } } {0 {0 1 2 3 4 5 5 6 7 8}} do_test select4-5.2g { catchsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY 1; } } {0 {0 1 2 3 4 5 5 6 7 8}} do_test select4-5.2h { catchsql { SELECT DISTINCT log FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY 2; } } {1 {ORDER BY position 2 should be between 1 and 1}} do_test select4-5.2i { catchsql { SELECT DISTINCT 1, log FROM t1 UNION ALL SELECT 2, n FROM t1 WHERE log=3 ORDER BY 2, 1; } } {0 {1 0 1 1 1 2 1 3 1 4 1 5 2 5 2 6 2 7 2 8}} do_test select4-5.2j { catchsql { SELECT DISTINCT 1, log FROM t1 UNION ALL SELECT 2, n FROM t1 WHERE log=3 ORDER BY 1, 2 DESC; } } {0 {1 5 1 4 1 3 1 2 1 1 1 0 2 8 2 7 2 6 2 5}} do_test select4-5.2k { catchsql { SELECT DISTINCT 1, log FROM t1 UNION ALL SELECT 2, n FROM t1 WHERE log=3 ORDER BY n, 1; } } {0 {1 0 1 1 1 2 1 3 1 4 1 5 2 5 2 6 2 7 2 8}} do_test select4-5.3 { set v [catch {execsql { SELECT DISTINCT log, n FROM t1 UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {SELECTs to the left and right of UNION ALL do not have the same number of result columns}} do_test select4-5.4 { set v [catch {execsql { SELECT log FROM t1 WHERE n=2 UNION ALL SELECT log FROM t1 WHERE n=3 UNION ALL SELECT log FROM t1 WHERE n=4 UNION ALL SELECT log FROM t1 WHERE n=5 ORDER BY log; }} msg] lappend v $msg } {0 {1 2 2 3}} do_test select4-6.1 { execsql { SELECT log, count(*) as cnt FROM t1 GROUP BY log UNION SELECT log, n FROM t1 WHERE n=7 ORDER BY cnt, log; } } {0 1 1 1 2 2 3 4 3 7 4 8 5 15} do_test select4-6.2 { execsql { SELECT log, count(*) FROM t1 GROUP BY log UNION SELECT log, n FROM t1 WHERE n=7 ORDER BY count(*), log; } } {0 1 1 1 2 2 3 4 3 7 4 8 5 15} # NULLs are indistinct for the UNION operator. # Make sure the UNION operator recognizes this # do_test select4-6.3 { execsql { SELECT NULL UNION SELECT NULL UNION SELECT 1 UNION SELECT 2 AS 'x' ORDER BY x; } } {{} 1 2} do_test select4-6.3.1 { execsql { SELECT NULL UNION ALL SELECT NULL UNION ALL SELECT 1 UNION ALL SELECT 2 AS 'x' ORDER BY x; } } {{} {} 1 2} # Make sure the DISTINCT keyword treats NULLs as indistinct. # do_test select4-6.4 { execsql { SELECT * FROM ( SELECT NULL, 1 UNION ALL SELECT NULL, 1 ); } } {{} 1 {} 1} do_test select4-6.5 { execsql { SELECT DISTINCT * FROM ( SELECT NULL, 1 UNION ALL SELECT NULL, 1 ); } } {{} 1} do_test select4-6.6 { execsql { SELECT DISTINCT * FROM ( SELECT 1,2 UNION ALL SELECT 1,2 ); } } {1 2} # Test distinctness of NULL in other ways. # do_test select4-6.7 { execsql { SELECT NULL EXCEPT SELECT NULL } } {} # Make sure column names are correct when a compound select appears as # an expression in the WHERE clause. # do_test select4-7.1 { execsql { CREATE TABLE t2 AS SELECT log AS 'x', count(*) AS 'y' FROM t1 GROUP BY log; SELECT * FROM t2 ORDER BY x; } } {0 1 1 1 2 2 3 4 4 8 5 15} do_test select4-7.2 { execsql2 { SELECT * FROM t1 WHERE n IN (SELECT n FROM t1 INTERSECT SELECT x FROM t2) ORDER BY n } } {n 1 log 0 n 2 log 1 n 3 log 2 n 4 log 2 n 5 log 3} do_test select4-7.3 { execsql2 { SELECT * FROM t1 WHERE n IN (SELECT n FROM t1 EXCEPT SELECT x FROM t2) ORDER BY n LIMIT 2 } } {n 6 log 3 n 7 log 3} do_test select4-7.4 { execsql2 { SELECT * FROM t1 WHERE n IN (SELECT n FROM t1 UNION SELECT x FROM t2) ORDER BY n LIMIT 2 } } {n 1 log 0 n 2 log 1} # Make sure DISTINCT works appropriately on TEXT and NUMERIC columns. # do_test select4-8.1 { execsql { BEGIN; CREATE TABLE t3(a text, b float, c text); INSERT INTO t3 VALUES(1, 1.1, '1.1'); INSERT INTO t3 VALUES(2, 1.10, '1.10'); INSERT INTO t3 VALUES(3, 1.10, '1.1'); INSERT INTO t3 VALUES(4, 1.1, '1.10'); INSERT INTO t3 VALUES(5, 1.2, '1.2'); INSERT INTO t3 VALUES(6, 1.3, '1.3'); COMMIT; } execsql { SELECT DISTINCT b FROM t3 ORDER BY c; } } {1.1 1.2 1.3} do_test select4-8.2 { execsql { SELECT DISTINCT c FROM t3 ORDER BY c; } } {1.1 1.10 1.2 1.3} finish_test sqlite-2.8.17/test/pager.test0000644000175000001440000002215010232547612016026 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is page cache subsystem. # # $Id: pager.test,v 1.14 2004/02/25 02:20:42 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands pager_open]!=""} { db close # Basic sanity check. Open and close a pager. # do_test pager-1.0 { catch {file delete -force ptf1.db} catch {file delete -force ptf1.db-journal} set v [catch { set ::p1 [pager_open ptf1.db 10] } msg] } {0} do_test pager-1.1 { pager_stats $::p1 } {ref 0 page 0 max 10 size -1 state 0 err 0 hit 0 miss 0 ovfl 0} do_test pager-1.2 { pager_pagecount $::p1 } {0} do_test pager-1.3 { pager_stats $::p1 } {ref 0 page 0 max 10 size -1 state 0 err 0 hit 0 miss 0 ovfl 0} do_test pager-1.4 { pager_close $::p1 } {} # Try to write a few pages. # do_test pager-2.1 { set v [catch { set ::p1 [pager_open ptf1.db 10] } msg] } {0} #do_test pager-2.2 { # set v [catch { # set ::g1 [page_get $::p1 0] # } msg] # lappend v $msg #} {1 SQLITE_ERROR} do_test pager-2.3.1 { set ::gx [page_lookup $::p1 1] } {} do_test pager-2.3.2 { pager_stats $::p1 } {ref 0 page 0 max 10 size -1 state 0 err 0 hit 0 miss 0 ovfl 0} do_test pager-2.3.3 { set v [catch { set ::g1 [page_get $::p1 1] } msg] if {$v} {lappend v $msg} set v } {0} do_test pager-2.3.3 { pager_stats $::p1 } {ref 1 page 1 max 10 size 0 state 1 err 0 hit 0 miss 1 ovfl 0} do_test pager-2.3.4 { set ::gx [page_lookup $::p1 1] expr {$::gx!=""} } {1} do_test pager-2.3.5 { pager_stats $::p1 } {ref 1 page 1 max 10 size 0 state 1 err 0 hit 0 miss 1 ovfl 0} do_test pager-2.3.6 { expr $::g1==$::gx } {1} do_test pager-2.3.7 { page_unref $::gx pager_stats $::p1 } {ref 1 page 1 max 10 size 0 state 1 err 0 hit 0 miss 1 ovfl 0} do_test pager-2.4 { pager_stats $::p1 } {ref 1 page 1 max 10 size 0 state 1 err 0 hit 0 miss 1 ovfl 0} do_test pager-2.5 { pager_pagecount $::p1 } {0} do_test pager-2.6 { pager_stats $::p1 } {ref 1 page 1 max 10 size 0 state 1 err 0 hit 0 miss 1 ovfl 0} do_test pager-2.7 { page_number $::g1 } {1} do_test pager-2.8 { page_read $::g1 } {} do_test pager-2.9 { page_unref $::g1 } {} do_test pager-2.10 { pager_stats $::p1 } {ref 0 page 0 max 10 size -1 state 0 err 0 hit 0 miss 1 ovfl 0} do_test pager-2.11 { set ::g1 [page_get $::p1 1] expr {$::g1!=0} } {1} do_test pager-2.12 { page_number $::g1 } {1} do_test pager-2.13 { pager_stats $::p1 } {ref 1 page 1 max 10 size 0 state 1 err 0 hit 0 miss 2 ovfl 0} do_test pager-2.14 { set v [catch { page_write $::g1 "Page-One" } msg] lappend v $msg } {0 {}} do_test pager-2.15 { pager_stats $::p1 } {ref 1 page 1 max 10 size 1 state 2 err 0 hit 0 miss 2 ovfl 0} do_test pager-2.16 { page_read $::g1 } {Page-One} do_test pager-2.17 { set v [catch { pager_commit $::p1 } msg] lappend v $msg } {0 {}} do_test pager-2.20 { pager_stats $::p1 } {ref 1 page 1 max 10 size -1 state 1 err 0 hit 0 miss 2 ovfl 0} do_test pager-2.19 { pager_pagecount $::p1 } {1} do_test pager-2.21 { pager_stats $::p1 } {ref 1 page 1 max 10 size 1 state 1 err 0 hit 0 miss 2 ovfl 0} do_test pager-2.22 { page_unref $::g1 } {} do_test pager-2.23 { pager_stats $::p1 } {ref 0 page 0 max 10 size -1 state 0 err 0 hit 0 miss 2 ovfl 0} do_test pager-2.24 { set v [catch { page_get $::p1 1 } ::g1] if {$v} {lappend v $::g1} set v } {0} do_test pager-2.25 { page_read $::g1 } {Page-One} do_test pager-2.26 { set v [catch { page_write $::g1 {page-one} } msg] lappend v $msg } {0 {}} do_test pager-2.27 { page_read $::g1 } {page-one} do_test pager-2.28 { set v [catch { pager_rollback $::p1 } msg] lappend v $msg } {0 {}} do_test pager-2.29 { page_unref $::g1 set ::g1 [page_get $::p1 1] page_read $::g1 } {Page-One} do_test pager-2.99 { pager_close $::p1 } {} do_test pager-3.1 { set v [catch { set ::p1 [pager_open ptf1.db 15] } msg] if {$v} {lappend v $msg} set v } {0} do_test pager-3.2 { pager_pagecount $::p1 } {1} do_test pager-3.3 { set v [catch { set ::g(1) [page_get $::p1 1] } msg] if {$v} {lappend v $msg} set v } {0} do_test pager-3.4 { page_read $::g(1) } {Page-One} do_test pager-3.5 { for {set i 2} {$i<=20} {incr i} { set gx [page_get $::p1 $i] page_write $gx "Page-$i" page_unref $gx } pager_commit $::p1 } {} for {set i 2} {$i<=20} {incr i} { do_test pager-3.6.[expr {$i-1}] [subst { set gx \[page_get $::p1 $i\] set v \[page_read \$gx\] page_unref \$gx set v }] "Page-$i" } for {set i 1} {$i<=20} {incr i} { regsub -all CNT { set ::g1 [page_get $::p1 CNT] set ::g2 [page_get $::p1 CNT] set ::vx [page_read $::g2] expr {$::g1==$::g2} } $i body; do_test pager-3.7.$i.1 $body {1} regsub -all CNT { page_unref $::g2 set vy [page_read $::g1] expr {$vy==$::vx} } $i body; do_test pager-3.7.$i.2 $body {1} regsub -all CNT { page_unref $::g1 set gx [page_get $::p1 CNT] set vy [page_read $gx] page_unref $gx expr {$vy==$::vx} } $i body; do_test pager-3.7.$i.3 $body {1} } do_test pager-3.99 { pager_close $::p1 } {} # tests of the checkpoint mechanism and api # do_test pager-4.0 { set v [catch { file delete -force ptf1.db set ::p1 [pager_open ptf1.db 15] } msg] if {$v} {lappend v $msg} set v } {0} do_test pager-4.1 { set g1 [page_get $::p1 1] page_write $g1 "Page-1 v0" for {set i 2} {$i<=20} {incr i} { set gx [page_get $::p1 $i] page_write $gx "Page-$i v0" page_unref $gx } pager_commit $::p1 } {} for {set i 1} {$i<=20} {incr i} { do_test pager-4.2.$i { set gx [page_get $p1 $i] set v [page_read $gx] page_unref $gx set v } "Page-$i v0" } do_test pager-4.3 { lrange [pager_stats $::p1] 0 1 } {ref 1} do_test pager-4.4 { lrange [pager_stats $::p1] 8 9 } {state 1} for {set i 1} {$i<20} {incr i} { do_test pager-4.5.$i.0 { set res {} for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] set value [page_read $gx] page_unref $gx set shouldbe "Page-$j v[expr {$i-1}]" if {$value!=$shouldbe} { lappend res $value $shouldbe } } set res } {} do_test pager-4.5.$i.1 { page_write $g1 "Page-1 v$i" lrange [pager_stats $p1] 8 9 } {state 2} do_test pager-4.5.$i.2 { for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] page_write $gx "Page-$j v$i" page_unref $gx if {$j==$i} { pager_ckpt_begin $p1 } } } {} do_test pager-4.5.$i.3 { set res {} for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] set value [page_read $gx] page_unref $gx set shouldbe "Page-$j v$i" if {$value!=$shouldbe} { lappend res $value $shouldbe } } set res } {} do_test pager-4.5.$i.4 { pager_rollback $p1 set res {} for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] set value [page_read $gx] page_unref $gx set shouldbe "Page-$j v[expr {$i-1}]" if {$value!=$shouldbe} { lappend res $value $shouldbe } } set res } {} do_test pager-4.5.$i.5 { page_write $g1 "Page-1 v$i" lrange [pager_stats $p1] 8 9 } {state 2} do_test pager-4.5.$i.6 { for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] page_write $gx "Page-$j v$i" page_unref $gx if {$j==$i} { pager_ckpt_begin $p1 } } } {} do_test pager-4.5.$i.7 { pager_ckpt_rollback $p1 for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] set value [page_read $gx] page_unref $gx if {$j<=$i || $i==1} { set shouldbe "Page-$j v$i" } else { set shouldbe "Page-$j v[expr {$i-1}]" } if {$value!=$shouldbe} { lappend res $value $shouldbe } } set res } {} do_test pager-4.5.$i.8 { for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] page_write $gx "Page-$j v$i" page_unref $gx if {$j==$i} { pager_ckpt_begin $p1 } } } {} do_test pager-4.5.$i.9 { pager_ckpt_commit $p1 for {set j 2} {$j<=20} {incr j} { set gx [page_get $p1 $j] set value [page_read $gx] page_unref $gx set shouldbe "Page-$j v$i" if {$value!=$shouldbe} { lappend res $value $shouldbe } } set res } {} do_test pager-4.5.$i.10 { pager_commit $p1 lrange [pager_stats $p1] 8 9 } {state 1} } do_test pager-4.99 { pager_close $::p1 } {} file delete -force ptf1.db } ;# end if( not mem: and has pager_open command ); # Ticket #615: an assertion fault inside the pager. It is a benign # fault, but we might as well test for it. # do_test pager-5.1 { sqlite db test.db execsql { BEGIN; CREATE TABLE t1(x); PRAGMA synchronous=off; COMMIT; } } {} finish_test sqlite-2.8.17/test/select5.test0000644000175000001440000000563710232547612016307 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing aggregate functions and the # GROUP BY and HAVING clauses of SELECT statements. # # $Id: select5.test,v 1.6 2001/10/15 00:44:36 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # set fd [open data1.txt w] for {set i 1} {$i<32} {incr i} { for {set j 0} {pow(2,$j)<$i} {incr j} {} puts $fd "[expr {32-$i}]\t[expr {10-$j}]" } close $fd execsql { CREATE TABLE t1(x int, y int); COPY t1 FROM 'data1.txt' } file delete data1.txt do_test select5-1.0 { execsql {SELECT DISTINCT y FROM t1 ORDER BY y} } {5 6 7 8 9 10} # Sort by an aggregate function. # do_test select5-1.1 { execsql {SELECT y, count(*) FROM t1 GROUP BY y ORDER BY y} } {5 15 6 8 7 4 8 2 9 1 10 1} do_test select5-1.2 { execsql {SELECT y, count(*) FROM t1 GROUP BY y ORDER BY count(*), y} } {9 1 10 1 8 2 7 4 6 8 5 15} do_test select5-1.3 { execsql {SELECT count(*), y FROM t1 GROUP BY y ORDER BY count(*), y} } {1 9 1 10 2 8 4 7 8 6 15 5} # Some error messages associated with aggregates and GROUP BY # do_test select5-2.1 { set v [catch {execsql { SELECT y, count(*) FROM t1 GROUP BY z ORDER BY y }} msg] lappend v $msg } {1 {no such column: z}} do_test select5-2.2 { set v [catch {execsql { SELECT y, count(*) FROM t1 GROUP BY z(y) ORDER BY y }} msg] lappend v $msg } {1 {no such function: z}} do_test select5-2.3 { set v [catch {execsql { SELECT y, count(*) FROM t1 GROUP BY y HAVING count(*)<3 ORDER BY y }} msg] lappend v $msg } {0 {8 2 9 1 10 1}} do_test select5-2.4 { set v [catch {execsql { SELECT y, count(*) FROM t1 GROUP BY y HAVING z(y)<3 ORDER BY y }} msg] lappend v $msg } {1 {no such function: z}} do_test select5-2.5 { set v [catch {execsql { SELECT y, count(*) FROM t1 GROUP BY y HAVING count(*)100 } } {{}} do_test select5-4.2 { execsql { SELECT count(x) FROM t1 WHERE x>100 } } {0} do_test select5-4.3 { execsql { SELECT min(x) FROM t1 WHERE x>100 } } {{}} do_test select5-4.4 { execsql { SELECT max(x) FROM t1 WHERE x>100 } } {{}} do_test select5-4.5 { execsql { SELECT sum(x) FROM t1 WHERE x>100 } } {0} finish_test sqlite-2.8.17/test/select6.test0000644000175000001440000002670210232547612016304 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that contain # subqueries in their FROM clause. # # $Id: select6.test,v 1.11 2004/01/24 20:18:13 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test select6-1.0 { execsql { BEGIN; CREATE TABLE t1(x, y); INSERT INTO t1 VALUES(1,1); INSERT INTO t1 VALUES(2,2); INSERT INTO t1 VALUES(3,2); INSERT INTO t1 VALUES(4,3); INSERT INTO t1 VALUES(5,3); INSERT INTO t1 VALUES(6,3); INSERT INTO t1 VALUES(7,3); INSERT INTO t1 VALUES(8,4); INSERT INTO t1 VALUES(9,4); INSERT INTO t1 VALUES(10,4); INSERT INTO t1 VALUES(11,4); INSERT INTO t1 VALUES(12,4); INSERT INTO t1 VALUES(13,4); INSERT INTO t1 VALUES(14,4); INSERT INTO t1 VALUES(15,4); INSERT INTO t1 VALUES(16,5); INSERT INTO t1 VALUES(17,5); INSERT INTO t1 VALUES(18,5); INSERT INTO t1 VALUES(19,5); INSERT INTO t1 VALUES(20,5); COMMIT; SELECT DISTINCT y FROM t1 ORDER BY y; } } {1 2 3 4 5} do_test select6-1.1 { execsql2 {SELECT * FROM (SELECT x, y FROM t1 WHERE x<2)} } {x 1 y 1} do_test select6-1.2 { execsql {SELECT count(*) FROM (SELECT y FROM t1)} } {20} do_test select6-1.3 { execsql {SELECT count(*) FROM (SELECT DISTINCT y FROM t1)} } {5} do_test select6-1.4 { execsql {SELECT count(*) FROM (SELECT DISTINCT * FROM (SELECT y FROM t1))} } {5} do_test select6-1.5 { execsql {SELECT count(*) FROM (SELECT * FROM (SELECT DISTINCT y FROM t1))} } {5} do_test select6-1.6 { execsql { SELECT * FROM (SELECT count(*),y FROM t1 GROUP BY y) AS a, (SELECT max(x),y FROM t1 GROUP BY y) as b WHERE a.y=b.y ORDER BY a.y } } {1 1 1 1 2 2 3 2 4 3 7 3 8 4 15 4 5 5 20 5} do_test select6-1.7 { execsql { SELECT a.y, a.[count(*)], [max(x)], [count(*)] FROM (SELECT count(*),y FROM t1 GROUP BY y) AS a, (SELECT max(x),y FROM t1 GROUP BY y) as b WHERE a.y=b.y ORDER BY a.y } } {1 1 1 1 2 2 3 2 3 4 7 4 4 8 15 8 5 5 20 5} do_test select6-1.8 { execsql { SELECT q, p, r FROM (SELECT count(*) as p , y as q FROM t1 GROUP BY y) AS a, (SELECT max(x) as r, y as s FROM t1 GROUP BY y) as b WHERE q=s ORDER BY s } } {1 1 1 2 2 3 3 4 7 4 8 15 5 5 20} do_test select6-1.9 { execsql { SELECT q, p, r, b.[min(x)+y] FROM (SELECT count(*) as p , y as q FROM t1 GROUP BY y) AS a, (SELECT max(x) as r, y as s, min(x)+y FROM t1 GROUP BY y) as b WHERE q=s ORDER BY s } } {1 1 1 2 2 2 3 4 3 4 7 7 4 8 15 12 5 5 20 21} do_test select6-2.0 { execsql { CREATE TABLE t2(a INTEGER PRIMARY KEY, b); INSERT INTO t2 SELECT * FROM t1; SELECT DISTINCT b FROM t2 ORDER BY b; } } {1 2 3 4 5} do_test select6-2.1 { execsql2 {SELECT * FROM (SELECT a, b FROM t2 WHERE a<2)} } {a 1 b 1} do_test select6-2.2 { execsql {SELECT count(*) FROM (SELECT b FROM t2)} } {20} do_test select6-2.3 { execsql {SELECT count(*) FROM (SELECT DISTINCT b FROM t2)} } {5} do_test select6-2.4 { execsql {SELECT count(*) FROM (SELECT DISTINCT * FROM (SELECT b FROM t2))} } {5} do_test select6-2.5 { execsql {SELECT count(*) FROM (SELECT * FROM (SELECT DISTINCT b FROM t2))} } {5} do_test select6-2.6 { execsql { SELECT * FROM (SELECT count(*),b FROM t2 GROUP BY b) AS a, (SELECT max(a),b FROM t2 GROUP BY b) as b WHERE a.b=b.b ORDER BY a.b } } {1 1 1 1 2 2 3 2 4 3 7 3 8 4 15 4 5 5 20 5} do_test select6-2.7 { execsql { SELECT a.b, a.[count(*)], [max(a)], [count(*)] FROM (SELECT count(*),b FROM t2 GROUP BY b) AS a, (SELECT max(a),b FROM t2 GROUP BY b) as b WHERE a.b=b.b ORDER BY a.b } } {1 1 1 1 2 2 3 2 3 4 7 4 4 8 15 8 5 5 20 5} do_test select6-2.8 { execsql { SELECT q, p, r FROM (SELECT count(*) as p , b as q FROM t2 GROUP BY b) AS a, (SELECT max(a) as r, b as s FROM t2 GROUP BY b) as b WHERE q=s ORDER BY s } } {1 1 1 2 2 3 3 4 7 4 8 15 5 5 20} do_test select6-2.9 { execsql { SELECT a.q, a.p, b.r FROM (SELECT count(*) as p , b as q FROM t2 GROUP BY q) AS a, (SELECT max(a) as r, b as s FROM t2 GROUP BY s) as b WHERE a.q=b.s ORDER BY a.q } } {1 1 1 2 2 3 3 4 7 4 8 15 5 5 20} do_test sqlite6-3.1 { execsql2 { SELECT * FROM (SELECT * FROM (SELECT * FROM t1 WHERE x=3)); } } {x 3 y 2} do_test sqlite6-3.2 { execsql { SELECT * FROM (SELECT a.q, a.p, b.r FROM (SELECT count(*) as p , b as q FROM t2 GROUP BY q) AS a, (SELECT max(a) as r, b as s FROM t2 GROUP BY s) as b WHERE a.q=b.s ORDER BY a.q) ORDER BY q } } {1 1 1 2 2 3 3 4 7 4 8 15 5 5 20} do_test select6-3.3 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1) } } {10.5 3.7 14.2} do_test select6-3.4 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1 WHERE y=4) } } {11.5 4 15.5} do_test select6-3.5 { execsql { SELECT x,y,x+y FROM (SELECT avg(a) as 'x', avg(b) as 'y' FROM t2 WHERE a=4) } } {4 3 7} do_test select6-3.6 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1) WHERE a>10 } } {10.5 3.7 14.2} do_test select6-3.7 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1) WHERE a<10 } } {} do_test select6-3.8 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1 WHERE y=4) WHERE a>10 } } {11.5 4 15.5} do_test select6-3.9 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1 WHERE y=4) WHERE a<10 } } {} do_test select6-3.10 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b) ORDER BY a } } {1 1 2 2.5 2 4.5 5.5 3 8.5 11.5 4 15.5 18 5 23} do_test select6-3.11 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b) WHERE b<4 ORDER BY a } } {1 1 2 2.5 2 4.5 5.5 3 8.5} do_test select6-3.12 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b HAVING a>1) WHERE b<4 ORDER BY a } } {2.5 2 4.5 5.5 3 8.5} do_test select6-3.13 { execsql { SELECT a,b,a+b FROM (SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b HAVING a>1) ORDER BY a } } {2.5 2 4.5 5.5 3 8.5 11.5 4 15.5 18 5 23} do_test select6-3.14 { execsql { SELECT [count(*)],y FROM (SELECT count(*), y FROM t1 GROUP BY y) ORDER BY [count(*)] } } {1 1 2 2 4 3 5 5 8 4} do_test select6-3.15 { execsql { SELECT [count(*)],y FROM (SELECT count(*), y FROM t1 GROUP BY y) ORDER BY y } } {1 1 2 2 4 3 8 4 5 5} do_test select6-4.1 { execsql { SELECT a,b,c FROM (SELECT x AS 'a', y AS 'b', x+y AS 'c' FROM t1 WHERE y=4) WHERE a<10 ORDER BY a; } } {8 4 12 9 4 13} do_test select6-4.2 { execsql { SELECT y FROM (SELECT DISTINCT y FROM t1) WHERE y<5 ORDER BY y } } {1 2 3 4} do_test select6-4.3 { execsql { SELECT DISTINCT y FROM (SELECT y FROM t1) WHERE y<5 ORDER BY y } } {1 2 3 4} do_test select6-4.4 { execsql { SELECT avg(y) FROM (SELECT DISTINCT y FROM t1) WHERE y<5 ORDER BY y } } {2.5} do_test select6-4.5 { execsql { SELECT avg(y) FROM (SELECT DISTINCT y FROM t1 WHERE y<5) ORDER BY y } } {2.5} do_test select6-5.1 { execsql { SELECT a,x,b FROM (SELECT x+3 AS 'a', x FROM t1 WHERE y=3) AS 'p', (SELECT x AS 'b' FROM t1 WHERE y=4) AS 'q' WHERE a=b ORDER BY a } } {8 5 8 9 6 9 10 7 10} do_test select6-5.2 { execsql { SELECT a,x,b FROM (SELECT x+3 AS 'a', x FROM t1 WHERE y=3), (SELECT x AS 'b' FROM t1 WHERE y=4) WHERE a=b ORDER BY a } } {8 5 8 9 6 9 10 7 10} # Tests of compound sub-selects # do_test select5-6.1 { execsql { DELETE FROM t1 WHERE x>4; SELECT * FROM t1 } } {1 1 2 2 3 2 4 3} do_test select6-6.2 { execsql { SELECT * FROM ( SELECT x AS 'a' FROM t1 UNION ALL SELECT x+10 AS 'a' FROM t1 ) ORDER BY a; } } {1 2 3 4 11 12 13 14} do_test select6-6.3 { execsql { SELECT * FROM ( SELECT x AS 'a' FROM t1 UNION ALL SELECT x+1 AS 'a' FROM t1 ) ORDER BY a; } } {1 2 2 3 3 4 4 5} do_test select6-6.4 { execsql { SELECT * FROM ( SELECT x AS 'a' FROM t1 UNION SELECT x+1 AS 'a' FROM t1 ) ORDER BY a; } } {1 2 3 4 5} do_test select6-6.5 { execsql { SELECT * FROM ( SELECT x AS 'a' FROM t1 INTERSECT SELECT x+1 AS 'a' FROM t1 ) ORDER BY a; } } {2 3 4} do_test select6-6.6 { execsql { SELECT * FROM ( SELECT x AS 'a' FROM t1 EXCEPT SELECT x*2 AS 'a' FROM t1 ) ORDER BY a; } } {1 3} # Subselects with no FROM clause # do_test select6-7.1 { execsql { SELECT * FROM (SELECT 1) } } {1} do_test select6-7.2 { execsql { SELECT c,b,a,* FROM (SELECT 1 AS 'a', 2 AS 'b', 'abc' AS 'c') } } {abc 2 1 1 2 abc} do_test select6-7.3 { execsql { SELECT c,b,a,* FROM (SELECT 1 AS 'a', 2 AS 'b', 'abc' AS 'c' WHERE 0) } } {} do_test select6-7.4 { execsql2 { SELECT c,b,a,* FROM (SELECT 1 AS 'a', 2 AS 'b', 'abc' AS 'c' WHERE 1) } } {c abc b 2 a 1 a 1 b 2 c abc} # The following procedure compiles the SQL given as an argument and returns # TRUE if that SQL uses any transient tables and returns FALSE if no # transient tables are used. This is used to make sure that the # sqliteFlattenSubquery() routine in select.c is doing its job. # proc is_flat {sql} { return [expr 0>[lsearch [execsql "EXPLAIN $sql"] OpenTemp]] } # Check that the flattener works correctly for deeply nested subqueries # involving joins. # do_test select6-8.1 { execsql { BEGIN; CREATE TABLE t3(p,q); INSERT INTO t3 VALUES(1,11); INSERT INTO t3 VALUES(2,22); CREATE TABLE t4(q,r); INSERT INTO t4 VALUES(11,111); INSERT INTO t4 VALUES(22,222); COMMIT; SELECT * FROM t3 NATURAL JOIN t4; } } {1 11 111 2 22 222} do_test select6-8.2 { execsql { SELECT y, p, q, r FROM (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m, (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n WHERE y=p } } {1 1 11 111 2 2 22 222 2 2 22 222} do_test select6-8.3 { is_flat { SELECT y, p, q, r FROM (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m, (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n WHERE y=p } } {1} do_test select6-8.4 { execsql { SELECT DISTINCT y, p, q, r FROM (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m, (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n WHERE y=p } } {1 1 11 111 2 2 22 222} do_test select6-8.5 { execsql { SELECT * FROM (SELECT y, p, q, r FROM (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m, (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n WHERE y=p) AS e, (SELECT r AS z FROM t4 WHERE q=11) AS f WHERE e.r=f.z } } {1 1 11 111 111} do_test select6-8.6 { is_flat { SELECT * FROM (SELECT y, p, q, r FROM (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m, (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n WHERE y=p) AS e, (SELECT r AS z FROM t4 WHERE q=11) AS f WHERE e.r=f.z } } {1} finish_test sqlite-2.8.17/test/join2.test0000644000175000001440000000337010232547612015754 0ustar drhusers00000000000000# 2002 May 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for joins, including outer joins. # # $Id: join2.test,v 1.1 2004/01/24 20:18:13 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test join2-1.1 { execsql { CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,11); INSERT INTO t1 VALUES(2,22); INSERT INTO t1 VALUES(3,33); SELECT * FROM t1; } } {1 11 2 22 3 33} do_test join2-1.2 { execsql { CREATE TABLE t2(b,c); INSERT INTO t2 VALUES(11,111); INSERT INTO t2 VALUES(33,333); INSERT INTO t2 VALUES(44,444); SELECT * FROM t2; } } {11 111 33 333 44 444}; do_test join2-1.3 { execsql { CREATE TABLE t3(c,d); INSERT INTO t3 VALUES(111,1111); INSERT INTO t3 VALUES(444,4444); INSERT INTO t3 VALUES(555,5555); SELECT * FROM t3; } } {111 1111 444 4444 555 5555} do_test join2-1.4 { execsql { SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 } } {1 11 111 1111} do_test join2-1.5 { execsql { SELECT * FROM t1 NATURAL JOIN t2 NATURAL LEFT OUTER JOIN t3 } } {1 11 111 1111 3 33 333 {}} do_test join2-1.6 { execsql { SELECT * FROM t1 NATURAL LEFT OUTER JOIN t2 NATURAL JOIN t3 } } {1 11 111 1111} do_test join2-1.6 { execsql { SELECT * FROM t1 NATURAL LEFT OUTER JOIN (t2 NATURAL JOIN t3) } } {1 11 111 1111 2 22 {} {} 3 33 {} {}} finish_test sqlite-2.8.17/test/pragma.test0000644000175000001440000002100410232547612016174 0ustar drhusers00000000000000# 2002 March 6 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # # $Id: pragma.test,v 1.9 2004/04/23 17:04:45 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Delete the preexisting database to avoid the special setup # that the "all.test" script does. # db close file delete test.db set DB [sqlite db test.db] do_test pragma-1.1 { execsql { PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {2000 2000 1 1} do_test pragma-1.2 { execsql { PRAGMA cache_size=1234; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {1234 2000 1 1} do_test pragma-1.3 { db close sqlite db test.db execsql { PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {2000 2000 1 1} do_test pragma-1.4 { execsql { PRAGMA synchronous=OFF; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {2000 2000 0 1} do_test pragma-1.5 { execsql { PRAGMA cache_size=4321; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {4321 2000 0 1} do_test pragma-1.6 { execsql { PRAGMA synchronous=ON; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {4321 2000 1 1} do_test pragma-1.7 { db close sqlite db test.db execsql { PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {2000 2000 1 1} do_test pragma-1.8 { execsql { PRAGMA default_synchronous=OFF; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {2000 2000 0 0} do_test pragma-1.9 { execsql { PRAGMA default_cache_size=123; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 0 0} do_test pragma-1.10 { db close set ::DB [sqlite db test.db] execsql { PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 0 0} do_test pragma-1.11 { execsql { PRAGMA synchronous=NORMAL; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 1 0} do_test pragma-1.12 { execsql { PRAGMA synchronous=FULL; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 2 0} do_test pragma-1.13 { db close set ::DB [sqlite db test.db] execsql { PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 0 0} do_test pragma-1.14 { execsql { PRAGMA default_synchronous=FULL; PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 2 2} do_test pragma-1.15 { db close set ::DB [sqlite db test.db] execsql { PRAGMA cache_size; PRAGMA default_cache_size; PRAGMA synchronous; PRAGMA default_synchronous; } } {123 123 2 2} do_test pragma-2.1 { execsql { PRAGMA show_datatypes=on; PRAGMA empty_result_callbacks=off; } sqlite_datatypes $::DB {SELECT * FROM sqlite_master} } {} do_test pragma-2.2 { execsql { PRAGMA empty_result_callbacks=on; } sqlite_datatypes $::DB {SELECT * FROM sqlite_master} } {text text text integer text} # Make sure we can read the schema when empty_result_callbacks are # turned on. Ticket #406 do_test pragma-2.2.1 { execsql { BEGIN; CREATE TABLE tabx(a,b,c,d); ROLLBACK; SELECT count(*) FROM sqlite_master; } } {0} do_test pragma-2.3 { execsql { CREATE TABLE t1( a INTEGER, b TEXT, c WHATEVER, d CLOB, e BLOB, f VARCHAR(123), g nVaRcHaR(432) ); } sqlite_datatypes $::DB {SELECT * FROM t1} } {INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)} do_test pragma-2.4 { sqlite_datatypes $::DB { SELECT 1, 'hello', NULL } } {NUMERIC TEXT TEXT} do_test pragma-2.5 { sqlite_datatypes $::DB { SELECT 1+2 AS X, 'hello' || 5 AS Y, NULL AS Z } } {NUMERIC TEXT TEXT} do_test pragma-2.6 { execsql { CREATE VIEW v1 AS SELECT a+b, b||c, * FROM t1; } sqlite_datatypes $::DB {SELECT * FROM v1} } {NUMERIC TEXT INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)} do_test pragma-2.7 { sqlite_datatypes $::DB { SELECT d,e FROM t1 UNION SELECT a,c FROM t1 } } {INTEGER WHATEVER} do_test pragma-2.8 { sqlite_datatypes $::DB { SELECT d,e FROM t1 EXCEPT SELECT c,e FROM t1 } } {WHATEVER BLOB} do_test pragma-2.9 { sqlite_datatypes $::DB { SELECT d,e FROM t1 INTERSECT SELECT c,e FROM t1 } } {WHATEVER BLOB} do_test pragma-2.10 { sqlite_datatypes $::DB { SELECT d,e FROM t1 INTERSECT SELECT c,e FROM v1 } } {WHATEVER BLOB} # Construct a corrupted index and make sure the integrity_check # pragma finds it. # if {![sqlite -has-codec]} { do_test pragma-3.1 { execsql { BEGIN; CREATE TABLE t2(a,b,c); CREATE INDEX i2 ON t2(a); INSERT INTO t2 VALUES(11,2,3); INSERT INTO t2 VALUES(22,3,4); COMMIT; SELECT rowid, * from t2; } } {1 11 2 3 2 22 3 4} do_test pragma-3.2 { set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}] set db [btree_open test.db] btree_begin_transaction $db set c [btree_cursor $db $rootpage 1] btree_first $c btree_delete $c btree_commit $db btree_close $db execsql {PRAGMA integrity_check} } {{rowid 1 missing from index i2} {wrong # of entries in index i2}} }; # endif has-codec # Test the temp_store and default_temp_store pragmas # do_test pragma-4.2 { execsql { PRAGMA temp_store='default'; PRAGMA temp_store; } } {0} do_test pragma-4.3 { execsql { PRAGMA temp_store='file'; PRAGMA temp_store; } } {1} do_test pragma-4.4 { execsql { PRAGMA temp_store='memory'; PRAGMA temp_store; } } {2} do_test pragma-4.5 { execsql { PRAGMA default_temp_store='default'; PRAGMA default_temp_store; } } {0} do_test pragma-4.6 { execsql { PRAGMA temp_store; } } {2} do_test pragma-4.7 { db close sqlite db test.db execsql { PRAGMA temp_store; } } {0} do_test pragma-4.8 { execsql { PRAGMA default_temp_store; } } {0} do_test pragma-4.9 { execsql { PRAGMA default_temp_store='file'; PRAGMA default_temp_store; } } {1} do_test pragma-4.10 { execsql { PRAGMA temp_store; } } {0} do_test pragma-4.11 { db close sqlite db test.db execsql { PRAGMA temp_store; } } {1} do_test pragma-4.12 { execsql { PRAGMA default_temp_store; } } {1} do_test pragma-4.13 { execsql { PRAGMA default_temp_store='memory'; PRAGMA default_temp_store; } } {2} do_test pragma-4.14 { execsql { PRAGMA temp_store; } } {1} do_test pragma-4.15 { db close sqlite db test.db execsql { PRAGMA temp_store; } } {2} do_test pragma-4.16 { execsql { PRAGMA default_temp_store; } } {2} do_test pragma-4.17 { execsql { PRAGMA temp_store='file'; PRAGMA temp_store } } {1} do_test pragma-4.18 { execsql { PRAGMA default_temp_store } } {2} do_test pragma-4.19 { db close sqlite db test.db execsql { PRAGMA temp_store } } {2} # Changing the TEMP_STORE deletes any existing temporary tables # do_test pragma-4.20 { execsql {SELECT name FROM sqlite_temp_master} } {} do_test pragma-4.21 { execsql { CREATE TEMP TABLE test1(a,b,c); SELECT name FROM sqlite_temp_master; } } {test1} do_test pragma-4.22 { execsql { PRAGMA temp_store='file'; SELECT name FROM sqlite_temp_master; } } {} do_test pragma-4.23 { execsql { CREATE TEMP TABLE test1(a,b,c); SELECT name FROM sqlite_temp_master; } } {test1} do_test pragma-4.24 { execsql { PRAGMA temp_store='memory'; SELECT name FROM sqlite_temp_master; } } {} do_test pragma-4.25 { catchsql { BEGIN; PRAGMA temp_store='default'; COMMIT; } } {1 {temporary storage cannot be changed from within a transaction}} catchsql {COMMIT} finish_test sqlite-2.8.17/test/insert.test0000644000175000001440000001673410232547612016247 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT statement. # # $Id: insert.test,v 1.15 2003/06/15 23:42:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to insert into a non-existant table. # do_test insert-1.1 { set v [catch {execsql {INSERT INTO test1 VALUES(1,2,3)}} msg] lappend v $msg } {1 {no such table: test1}} # Try to insert into sqlite_master # do_test insert-1.2 { set v [catch {execsql {INSERT INTO sqlite_master VALUES(1,2,3,4)}} msg] lappend v $msg } {1 {table sqlite_master may not be modified}} # Try to insert the wrong number of entries. # do_test insert-1.3 { execsql {CREATE TABLE test1(one int, two int, three int)} set v [catch {execsql {INSERT INTO test1 VALUES(1,2)}} msg] lappend v $msg } {1 {table test1 has 3 columns but 2 values were supplied}} do_test insert-1.3b { set v [catch {execsql {INSERT INTO test1 VALUES(1,2,3,4)}} msg] lappend v $msg } {1 {table test1 has 3 columns but 4 values were supplied}} do_test insert-1.3c { set v [catch {execsql {INSERT INTO test1(one,two) VALUES(1,2,3,4)}} msg] lappend v $msg } {1 {4 values for 2 columns}} do_test insert-1.3d { set v [catch {execsql {INSERT INTO test1(one,two) VALUES(1)}} msg] lappend v $msg } {1 {1 values for 2 columns}} # Try to insert into a non-existant column of a table. # do_test insert-1.4 { set v [catch {execsql {INSERT INTO test1(one,four) VALUES(1,2)}} msg] lappend v $msg } {1 {table test1 has no column named four}} # Make sure the inserts actually happen # do_test insert-1.5 { execsql {INSERT INTO test1 VALUES(1,2,3)} execsql {SELECT * FROM test1} } {1 2 3} do_test insert-1.5b { execsql {INSERT INTO test1 VALUES(4,5,6)} execsql {SELECT * FROM test1 ORDER BY one} } {1 2 3 4 5 6} do_test insert-1.5c { execsql {INSERT INTO test1 VALUES(7,8,9)} execsql {SELECT * FROM test1 ORDER BY one} } {1 2 3 4 5 6 7 8 9} do_test insert-1.6 { execsql {DELETE FROM test1} execsql {INSERT INTO test1(one,two) VALUES(1,2)} execsql {SELECT * FROM test1 ORDER BY one} } {1 2 {}} do_test insert-1.6b { execsql {INSERT INTO test1(two,three) VALUES(5,6)} execsql {SELECT * FROM test1 ORDER BY one} } {{} 5 6 1 2 {}} do_test insert-1.6c { execsql {INSERT INTO test1(three,one) VALUES(7,8)} execsql {SELECT * FROM test1 ORDER BY one} } {{} 5 6 1 2 {} 8 {} 7} # A table to use for testing default values # do_test insert-2.1 { execsql { CREATE TABLE test2( f1 int default -111, f2 real default +4.32, f3 int default +222, f4 int default 7.89 ) } execsql {SELECT * from test2} } {} do_test insert-2.2 { execsql {INSERT INTO test2(f1,f3) VALUES(+10,-10)} execsql {SELECT * FROM test2} } {10 4.32 -10 7.89} do_test insert-2.3 { execsql {INSERT INTO test2(f2,f4) VALUES(1.23,-3.45)} execsql {SELECT * FROM test2 WHERE f1==-111} } {-111 1.23 222 -3.45} do_test insert-2.4 { execsql {INSERT INTO test2(f1,f2,f4) VALUES(77,+1.23,3.45)} execsql {SELECT * FROM test2 WHERE f1==77} } {77 1.23 222 3.45} do_test insert-2.10 { execsql { DROP TABLE test2; CREATE TABLE test2( f1 int default 111, f2 real default -4.32, f3 text default hi, f4 text default 'abc-123', f5 varchar(10) ) } execsql {SELECT * from test2} } {} do_test insert-2.11 { execsql {INSERT INTO test2(f2,f4) VALUES(-2.22,'hi!')} execsql {SELECT * FROM test2} } {111 -2.22 hi hi! {}} do_test insert-2.12 { execsql {INSERT INTO test2(f1,f5) VALUES(1,'xyzzy')} execsql {SELECT * FROM test2 ORDER BY f1} } {1 -4.32 hi abc-123 xyzzy 111 -2.22 hi hi! {}} # Do additional inserts with default values, but this time # on a table that has indices. In particular we want to verify # that the correct default values are inserted into the indices. # do_test insert-3.1 { execsql { DELETE FROM test2; CREATE INDEX index9 ON test2(f1,f2); CREATE INDEX indext ON test2(f4,f5); SELECT * from test2; } } {} do_test insert-3.2 { execsql {INSERT INTO test2(f2,f4) VALUES(-3.33,'hum')} execsql {SELECT * FROM test2 WHERE f1=111 AND f2=-3.33} } {111 -3.33 hi hum {}} do_test insert-3.3 { execsql {INSERT INTO test2(f1,f2,f5) VALUES(22,-4.44,'wham')} execsql {SELECT * FROM test2 WHERE f1=111 AND f2=-3.33} } {111 -3.33 hi hum {}} do_test insert-3.4 { execsql {SELECT * FROM test2 WHERE f1=22 AND f2=-4.44} } {22 -4.44 hi abc-123 wham} integrity_check insert-3.5 # Test of expressions in the VALUES clause # do_test insert-4.1 { execsql { CREATE TABLE t3(a,b,c); INSERT INTO t3 VALUES(1+2+3,4,5); SELECT * FROM t3; } } {6 4 5} do_test insert-4.2 { execsql { INSERT INTO t3 VALUES((SELECT max(a) FROM t3)+1,5,6); SELECT * FROM t3 ORDER BY a; } } {6 4 5 7 5 6} do_test insert-4.3 { catchsql { INSERT INTO t3 VALUES((SELECT max(a) FROM t3)+1,t3.a,6); SELECT * FROM t3 ORDER BY a; } } {1 {no such column: t3.a}} do_test insert-4.4 { execsql { INSERT INTO t3 VALUES((SELECT b FROM t3 WHERE a=0),6,7); SELECT * FROM t3 ORDER BY a; } } {{} 6 7 6 4 5 7 5 6} do_test insert-4.5 { execsql { SELECT b,c FROM t3 WHERE a IS NULL; } } {6 7} do_test insert-4.6 { catchsql { INSERT INTO t3 VALUES(notafunc(2,3),2,3); } } {1 {no such function: notafunc}} do_test insert-4.7 { execsql { INSERT INTO t3 VALUES(min(1,2,3),max(1,2,3),99); SELECT * FROM t3 WHERE c=99; } } {1 3 99} # Test the ability to insert from a temporary table into itself. # Ticket #275. # do_test insert-5.1 { execsql { CREATE TEMP TABLE t4(x); INSERT INTO t4 VALUES(1); SELECT * FROM t4; } } {1} do_test insert-5.2 { execsql { INSERT INTO t4 SELECT x+1 FROM t4; SELECT * FROM t4; } } {1 2} do_test insert-5.3 { # verify that a temporary table is used to copy t4 to t4 set x [execsql { EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4; }] expr {[lsearch $x OpenTemp]>0} } {1} do_test insert-5.4 { # Verify that table "test1" begins on page 3. This should be the same # page number used by "t4" above. execsql { SELECT rootpage FROM sqlite_master WHERE name='test1'; } } {3} do_test insert-5.5 { # Verify that "t4" begins on page 3. execsql { SELECT rootpage FROM sqlite_temp_master WHERE name='t4'; } } {3} do_test insert-5.6 { # This should not use an intermediate temporary table. execsql { INSERT INTO t4 SELECT one FROM test1 WHERE three=7; SELECT * FROM t4 } } {1 2 8} do_test insert-5.7 { # verify that no temporary table is used to copy test1 to t4 set x [execsql { EXPLAIN INSERT INTO t4 SELECT one FROM test1; }] expr {[lsearch $x OpenTemp]>0} } {0} # Ticket #334: REPLACE statement corrupting indices. # do_test insert-6.1 { execsql { CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(2,3); SELECT b FROM t1 WHERE b=2; } } {2} do_test insert-6.2 { execsql { REPLACE INTO t1 VALUES(1,4); SELECT b FROM t1 WHERE b=2; } } {} do_test insert-6.3 { execsql { UPDATE OR REPLACE t1 SET a=2 WHERE b=4; SELECT * FROM t1 WHERE b=4; } } {2 4} do_test insert-6.4 { execsql { SELECT * FROM t1 WHERE b=3; } } {} integrity_check insert-99.0 finish_test sqlite-2.8.17/test/auth.test0000644000175000001440000013154610232547612015703 0ustar drhusers00000000000000# 2003 April 4 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: auth.test,v 1.12.2.1 2004/09/09 13:54:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is # defined during compilation. do_test auth-1.1.1 { db close set ::DB [sqlite db test.db] proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } db authorizer ::auth catchsql {CREATE TABLE t1(a,b,c)} } {1 {not authorized}} do_test auth-1.1.2 { db errorcode } {23} do_test auth-1.1.3 { # Ticket #896. catchsql { SELECT x; } } {1 {no such column: x}} do_test auth-1.2 { execsql {SELECT name FROM sqlite_master} } {} do_test auth-1.3.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TABLE t1(a,b,c)} } {1 {not authorized}} do_test auth-1.3.2 { db errorcode } {23} do_test auth-1.3.3 { set ::authargs } {t1 {} main {}} do_test auth-1.4 { execsql {SELECT name FROM sqlite_master} } {} do_test auth-1.5 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TEMP TABLE t1(a,b,c)} } {1 {not authorized}} do_test auth-1.6 { execsql {SELECT name FROM sqlite_temp_master} } {} do_test auth-1.7.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TEMP TABLE t1(a,b,c)} } {1 {not authorized}} do_test auth-1.7.2 { set ::authargs } {t1 {} temp {}} do_test auth-1.8 { execsql {SELECT name FROM sqlite_temp_master} } {} do_test auth-1.9 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE TABLE t1(a,b,c)} } {0 {}} do_test auth-1.10 { execsql {SELECT name FROM sqlite_master} } {} do_test auth-1.11 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE TABLE t1(a,b,c)} } {0 {}} do_test auth-1.12 { execsql {SELECT name FROM sqlite_master} } {} do_test auth-1.13 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE TEMP TABLE t1(a,b,c)} } {0 {}} do_test auth-1.14 { execsql {SELECT name FROM sqlite_temp_master} } {} do_test auth-1.15 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE TEMP TABLE t1(a,b,c)} } {0 {}} do_test auth-1.16 { execsql {SELECT name FROM sqlite_temp_master} } {} do_test auth-1.17 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TEMP TABLE t1(a,b,c)} } {0 {}} do_test auth-1.18 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.19.1 { set ::authargs {} proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TABLE t2(a,b,c)} } {0 {}} do_test auth-1.19.2 { set ::authargs } {} do_test auth-1.20 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.21.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TABLE t2} } {1 {not authorized}} do_test auth-1.21.2 { set ::authargs } {t2 {} main {}} do_test auth-1.22 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.23.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TABLE t2} } {0 {}} do_test auth-1.23.2 { set ::authargs } {t2 {} main {}} do_test auth-1.24 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.25 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TABLE t1} } {1 {not authorized}} do_test auth-1.26 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.27 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TABLE t1} } {0 {}} do_test auth-1.28 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.29 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="t2"} { return SQLITE_DENY } return SQLITE_OK } catchsql {INSERT INTO t2 VALUES(1,2,3)} } {1 {not authorized}} do_test auth-1.30 { execsql {SELECT * FROM t2} } {} do_test auth-1.31 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="t2"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {INSERT INTO t2 VALUES(1,2,3)} } {0 {}} do_test auth-1.32 { execsql {SELECT * FROM t2} } {} do_test auth-1.33 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="t1"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {INSERT INTO t2 VALUES(1,2,3)} } {0 {}} do_test auth-1.34 { execsql {SELECT * FROM t2} } {1 2 3} do_test auth-1.35.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_DENY } return SQLITE_OK } catchsql {SELECT * FROM t2} } {1 {access to t2.b is prohibited}} do_test auth-1.35.2 { execsql {ATTACH DATABASE 'test.db' AS two} catchsql {SELECT * FROM two.t2} } {1 {access to two.t2.b is prohibited}} execsql {DETACH DATABASE two} do_test auth-1.36 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2} } {0 {1 {} 3}} do_test auth-1.37 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2 WHERE b=2} } {0 {}} do_test auth-1.38 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="a"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2 WHERE b=2} } {0 {{} 2 3}} do_test auth-1.39 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2 WHERE b IS NULL} } {0 {1 {} 3}} do_test auth-1.40 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_DENY } return SQLITE_OK } catchsql {SELECT a,c FROM t2 WHERE b IS NULL} } {1 {access to t2.b is prohibited}} do_test auth-1.41 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_UPDATE" && $arg1=="t2" && $arg2=="b"} { return SQLITE_DENY } return SQLITE_OK } catchsql {UPDATE t2 SET a=11} } {0 {}} do_test auth-1.42 { execsql {SELECT * FROM t2} } {11 2 3} do_test auth-1.43 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_UPDATE" && $arg1=="t2" && $arg2=="b"} { return SQLITE_DENY } return SQLITE_OK } catchsql {UPDATE t2 SET b=22, c=33} } {1 {not authorized}} do_test auth-1.44 { execsql {SELECT * FROM t2} } {11 2 3} do_test auth-1.45 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_UPDATE" && $arg1=="t2" && $arg2=="b"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {UPDATE t2 SET b=22, c=33} } {0 {}} do_test auth-1.46 { execsql {SELECT * FROM t2} } {11 2 33} do_test auth-1.47 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="t2"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DELETE FROM t2 WHERE a=11} } {1 {not authorized}} do_test auth-1.48 { execsql {SELECT * FROM t2} } {11 2 33} do_test auth-1.49 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="t2"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DELETE FROM t2 WHERE a=11} } {0 {}} do_test auth-1.50 { execsql {SELECT * FROM t2} } {11 2 33} do_test auth-1.51 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_SELECT"} { return SQLITE_DENY } return SQLITE_OK } catchsql {SELECT * FROM t2} } {1 {not authorized}} do_test auth-1.52 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_SELECT"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2} } {0 {}} do_test auth-1.53 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_SELECT"} { return SQLITE_OK } return SQLITE_OK } catchsql {SELECT * FROM t2} } {0 {11 2 33}} set f [open data1.txt w] puts $f "7:8:9" close $f do_test auth-1.54 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_COPY"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {COPY t2 FROM 'data1.txt' USING DELIMITERS ':'} } {1 {not authorized}} do_test auth-1.55 { set ::authargs } {t2 data1.txt main {}} do_test auth-1.56 { execsql {SELECT * FROM t2} } {11 2 33} do_test auth-1.57 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_COPY"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {COPY t2 FROM 'data1.txt' USING DELIMITERS ':'} } {0 {}} do_test auth-1.58 { set ::authargs } {t2 data1.txt main {}} do_test auth-1.59 { execsql {SELECT * FROM t2} } {11 2 33} do_test auth-1.60 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_COPY"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {COPY t2 FROM 'data1.txt' USING DELIMITERS ':'} } {0 {}} do_test auth-1.61 { set ::authargs } {t2 data1.txt main {}} do_test auth-1.62 { execsql {SELECT * FROM t2} } {11 2 33 7 8 9} do_test auth-1.63 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TABLE t2} } {1 {not authorized}} do_test auth-1.64 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.65 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="t2"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TABLE t2} } {1 {not authorized}} do_test auth-1.66 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.67 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TABLE t1} } {1 {not authorized}} do_test auth-1.68 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.69 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="t1"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TABLE t1} } {1 {not authorized}} do_test auth-1.70 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.71 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TABLE t2} } {0 {}} do_test auth-1.72 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.73 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="t2"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TABLE t2} } {0 {}} do_test auth-1.74 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.75 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TABLE t1} } {0 {}} do_test auth-1.76 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.77 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="t1"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TABLE t1} } {0 {}} do_test auth-1.78 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.79 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2} } {1 {not authorized}} do_test auth-1.80 { set ::authargs } {v1 {} main {}} do_test auth-1.81 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.82 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2} } {0 {}} do_test auth-1.83 { set ::authargs } {v1 {} main {}} do_test auth-1.84 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.85 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2} } {1 {not authorized}} do_test auth-1.86 { set ::authargs } {v1 {} temp {}} do_test auth-1.87 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.88 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2} } {0 {}} do_test auth-1.89 { set ::authargs } {v1 {} temp {}} do_test auth-1.90 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.91 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2} } {1 {not authorized}} do_test auth-1.92 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.93 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2} } {0 {}} do_test auth-1.94 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.95 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2} } {1 {not authorized}} do_test auth-1.96 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.97 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2} } {0 {}} do_test auth-1.98 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.99 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql { CREATE VIEW v2 AS SELECT a+1,b+1 FROM t2; DROP VIEW v2 } } {1 {not authorized}} do_test auth-1.100 { execsql {SELECT name FROM sqlite_master} } {t2 v2} do_test auth-1.101 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP VIEW v2} } {1 {not authorized}} do_test auth-1.102 { set ::authargs } {v2 {} main {}} do_test auth-1.103 { execsql {SELECT name FROM sqlite_master} } {t2 v2} do_test auth-1.104 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP VIEW v2} } {0 {}} do_test auth-1.105 { execsql {SELECT name FROM sqlite_master} } {t2 v2} do_test auth-1.106 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP VIEW v2} } {0 {}} do_test auth-1.107 { set ::authargs } {v2 {} main {}} do_test auth-1.108 { execsql {SELECT name FROM sqlite_master} } {t2 v2} do_test auth-1.109 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {DROP VIEW v2} } {0 {}} do_test auth-1.110 { set ::authargs } {v2 {} main {}} do_test auth-1.111 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.112 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql { CREATE TEMP VIEW v1 AS SELECT a+1,b+1 FROM t1; DROP VIEW v1 } } {1 {not authorized}} do_test auth-1.113 { execsql {SELECT name FROM sqlite_temp_master} } {t1 v1} do_test auth-1.114 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP VIEW v1} } {1 {not authorized}} do_test auth-1.115 { set ::authargs } {v1 {} temp {}} do_test auth-1.116 { execsql {SELECT name FROM sqlite_temp_master} } {t1 v1} do_test auth-1.117 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP VIEW v1} } {0 {}} do_test auth-1.118 { execsql {SELECT name FROM sqlite_temp_master} } {t1 v1} do_test auth-1.119 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP VIEW v1} } {0 {}} do_test auth-1.120 { set ::authargs } {v1 {} temp {}} do_test auth-1.121 { execsql {SELECT name FROM sqlite_temp_master} } {t1 v1} do_test auth-1.122 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_VIEW"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {DROP VIEW v1} } {0 {}} do_test auth-1.123 { set ::authargs } {v1 {} temp {}} do_test auth-1.124 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.125 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql { CREATE TRIGGER r2 DELETE on t2 BEGIN SELECT NULL; END; } } {1 {not authorized}} do_test auth-1.126 { set ::authargs } {r2 t2 main {}} do_test auth-1.127 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.128 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql { CREATE TRIGGER r2 DELETE on t2 BEGIN SELECT NULL; END; } } {1 {not authorized}} do_test auth-1.129 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.130 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql { CREATE TRIGGER r2 DELETE on t2 BEGIN SELECT NULL; END; } } {0 {}} do_test auth-1.131 { set ::authargs } {r2 t2 main {}} do_test auth-1.132 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.133 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql { CREATE TRIGGER r2 DELETE on t2 BEGIN SELECT NULL; END; } } {0 {}} do_test auth-1.134 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.135 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql { CREATE TABLE tx(id); CREATE TRIGGER r2 AFTER INSERT ON t2 BEGIN INSERT INTO tx VALUES(NEW.rowid); END; } } {0 {}} do_test auth-1.136.1 { set ::authargs } {r2 t2 main {}} do_test auth-1.136.2 { execsql { SELECT name FROM sqlite_master WHERE type='trigger' } } {r2} do_test auth-1.136.3 { proc auth {code arg1 arg2 arg3 arg4} { lappend ::authargs $code $arg1 $arg2 $arg3 $arg4 return SQLITE_OK } set ::authargs {} execsql { INSERT INTO t2 VALUES(1,2,3); } set ::authargs } {SQLITE_INSERT t2 {} main {} SQLITE_INSERT tx {} main r2 SQLITE_READ t2 ROWID main r2} do_test auth-1.136.4 { execsql { SELECT * FROM tx; } } {3} do_test auth-1.137 { execsql {SELECT name FROM sqlite_master} } {t2 tx r2} do_test auth-1.138 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql { CREATE TRIGGER r1 DELETE on t1 BEGIN SELECT NULL; END; } } {1 {not authorized}} do_test auth-1.139 { set ::authargs } {r1 t1 temp {}} do_test auth-1.140 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.141 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql { CREATE TRIGGER r1 DELETE on t1 BEGIN SELECT NULL; END; } } {1 {not authorized}} do_test auth-1.142 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.143 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql { CREATE TRIGGER r1 DELETE on t1 BEGIN SELECT NULL; END; } } {0 {}} do_test auth-1.144 { set ::authargs } {r1 t1 temp {}} do_test auth-1.145 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.146 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql { CREATE TRIGGER r1 DELETE on t1 BEGIN SELECT NULL; END; } } {0 {}} do_test auth-1.147 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.148 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql { CREATE TRIGGER r1 DELETE on t1 BEGIN SELECT NULL; END; } } {0 {}} do_test auth-1.149 { set ::authargs } {r1 t1 temp {}} do_test auth-1.150 { execsql {SELECT name FROM sqlite_temp_master} } {t1 r1} do_test auth-1.151 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TRIGGER r2} } {1 {not authorized}} do_test auth-1.152 { execsql {SELECT name FROM sqlite_master} } {t2 tx r2} do_test auth-1.153 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TRIGGER r2} } {1 {not authorized}} do_test auth-1.154 { set ::authargs } {r2 t2 main {}} do_test auth-1.155 { execsql {SELECT name FROM sqlite_master} } {t2 tx r2} do_test auth-1.156 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TRIGGER r2} } {0 {}} do_test auth-1.157 { execsql {SELECT name FROM sqlite_master} } {t2 tx r2} do_test auth-1.158 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TRIGGER r2} } {0 {}} do_test auth-1.159 { set ::authargs } {r2 t2 main {}} do_test auth-1.160 { execsql {SELECT name FROM sqlite_master} } {t2 tx r2} do_test auth-1.161 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {DROP TRIGGER r2} } {0 {}} do_test auth-1.162 { set ::authargs } {r2 t2 main {}} do_test auth-1.163 { execsql { DROP TABLE tx; DELETE FROM t2 WHERE a=1 AND b=2 AND c=3; SELECT name FROM sqlite_master; } } {t2} do_test auth-1.164 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TRIGGER r1} } {1 {not authorized}} do_test auth-1.165 { execsql {SELECT name FROM sqlite_temp_master} } {t1 r1} do_test auth-1.166 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP TRIGGER r1} } {1 {not authorized}} do_test auth-1.167 { set ::authargs } {r1 t1 temp {}} do_test auth-1.168 { execsql {SELECT name FROM sqlite_temp_master} } {t1 r1} do_test auth-1.169 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TRIGGER r1} } {0 {}} do_test auth-1.170 { execsql {SELECT name FROM sqlite_temp_master} } {t1 r1} do_test auth-1.171 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP TRIGGER r1} } {0 {}} do_test auth-1.172 { set ::authargs } {r1 t1 temp {}} do_test auth-1.173 { execsql {SELECT name FROM sqlite_temp_master} } {t1 r1} do_test auth-1.174 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_TRIGGER"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {DROP TRIGGER r1} } {0 {}} do_test auth-1.175 { set ::authargs } {r1 t1 temp {}} do_test auth-1.176 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.177 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE INDEX i2 ON t2(a)} } {1 {not authorized}} do_test auth-1.178 { set ::authargs } {i2 t2 main {}} do_test auth-1.179 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.180 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE INDEX i2 ON t2(a)} } {1 {not authorized}} do_test auth-1.181 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.182 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE INDEX i2 ON t2(b)} } {0 {}} do_test auth-1.183 { set ::authargs } {i2 t2 main {}} do_test auth-1.184 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.185 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE INDEX i2 ON t2(b)} } {0 {}} do_test auth-1.186 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.187 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {CREATE INDEX i2 ON t2(a)} } {0 {}} do_test auth-1.188 { set ::authargs } {i2 t2 main {}} do_test auth-1.189 { execsql {SELECT name FROM sqlite_master} } {t2 i2} do_test auth-1.190 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE INDEX i1 ON t1(a)} } {1 {not authorized}} do_test auth-1.191 { set ::authargs } {i1 t1 temp {}} do_test auth-1.192 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.193 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {CREATE INDEX i1 ON t1(b)} } {1 {not authorized}} do_test auth-1.194 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.195 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE INDEX i1 ON t1(b)} } {0 {}} do_test auth-1.196 { set ::authargs } {i1 t1 temp {}} do_test auth-1.197 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.198 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {CREATE INDEX i1 ON t1(c)} } {0 {}} do_test auth-1.199 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.200 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TEMP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {CREATE INDEX i1 ON t1(a)} } {0 {}} do_test auth-1.201 { set ::authargs } {i1 t1 temp {}} do_test auth-1.202 { execsql {SELECT name FROM sqlite_temp_master} } {t1 i1} do_test auth-1.203 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP INDEX i2} } {1 {not authorized}} do_test auth-1.204 { execsql {SELECT name FROM sqlite_master} } {t2 i2} do_test auth-1.205 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP INDEX i2} } {1 {not authorized}} do_test auth-1.206 { set ::authargs } {i2 t2 main {}} do_test auth-1.207 { execsql {SELECT name FROM sqlite_master} } {t2 i2} do_test auth-1.208 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP INDEX i2} } {0 {}} do_test auth-1.209 { execsql {SELECT name FROM sqlite_master} } {t2 i2} do_test auth-1.210 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP INDEX i2} } {0 {}} do_test auth-1.211 { set ::authargs } {i2 t2 main {}} do_test auth-1.212 { execsql {SELECT name FROM sqlite_master} } {t2 i2} do_test auth-1.213 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {DROP INDEX i2} } {0 {}} do_test auth-1.214 { set ::authargs } {i2 t2 main {}} do_test auth-1.215 { execsql {SELECT name FROM sqlite_master} } {t2} do_test auth-1.216 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_DENY } return SQLITE_OK } catchsql {DROP INDEX i1} } {1 {not authorized}} do_test auth-1.217 { execsql {SELECT name FROM sqlite_temp_master} } {t1 i1} do_test auth-1.218 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {DROP INDEX i1} } {1 {not authorized}} do_test auth-1.219 { set ::authargs } {i1 t1 temp {}} do_test auth-1.220 { execsql {SELECT name FROM sqlite_temp_master} } {t1 i1} do_test auth-1.221 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP INDEX i1} } {0 {}} do_test auth-1.222 { execsql {SELECT name FROM sqlite_temp_master} } {t1 i1} do_test auth-1.223 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {DROP INDEX i1} } {0 {}} do_test auth-1.224 { set ::authargs } {i1 t1 temp {}} do_test auth-1.225 { execsql {SELECT name FROM sqlite_temp_master} } {t1 i1} do_test auth-1.226 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DROP_TEMP_INDEX"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {DROP INDEX i1} } {0 {}} do_test auth-1.227 { set ::authargs } {i1 t1 temp {}} do_test auth-1.228 { execsql {SELECT name FROM sqlite_temp_master} } {t1} do_test auth-1.229 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_PRAGMA"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {PRAGMA full_column_names=on} } {1 {not authorized}} do_test auth-1.230 { set ::authargs } {full_column_names on {} {}} do_test auth-1.231 { execsql2 {SELECT a FROM t2} } {a 11 a 7} do_test auth-1.232 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_PRAGMA"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql {PRAGMA full_column_names=on} } {0 {}} do_test auth-1.233 { set ::authargs } {full_column_names on {} {}} do_test auth-1.234 { execsql2 {SELECT a FROM t2} } {a 11 a 7} do_test auth-1.235 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_PRAGMA"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {PRAGMA full_column_names=on} } {0 {}} do_test auth-1.236 { execsql2 {SELECT a FROM t2} } {t2.a 11 t2.a 7} do_test auth-1.237 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_PRAGMA"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } catchsql {PRAGMA full_column_names=OFF} } {0 {}} do_test auth-1.238 { set ::authargs } {full_column_names OFF {} {}} do_test auth-1.239 { execsql2 {SELECT a FROM t2} } {a 11 a 7} do_test auth-1.240 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_TRANSACTION"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {BEGIN} } {1 {not authorized}} do_test auth-1.241 { set ::authargs } {BEGIN {} {} {}} do_test auth-1.242 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_TRANSACTION" && $arg1!="BEGIN"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql {BEGIN; INSERT INTO t2 VALUES(44,55,66); COMMIT} } {1 {not authorized}} do_test auth-1.243 { set ::authargs } {COMMIT {} {} {}} do_test auth-1.244 { execsql {SELECT * FROM t2} } {11 2 33 7 8 9 44 55 66} do_test auth-1.245 { catchsql {ROLLBACK} } {1 {not authorized}} do_test auth-1.246 { set ::authargs } {ROLLBACK {} {} {}} do_test auth-1.247 { catchsql {END TRANSACTION} } {1 {not authorized}} do_test auth-1.248 { set ::authargs } {COMMIT {} {} {}} do_test auth-1.249 { db authorizer {} catchsql {ROLLBACK} } {0 {}} do_test auth-1.250 { execsql {SELECT * FROM t2} } {11 2 33 7 8 9} # ticket #340 - authorization for ATTACH and DETACH. # do_test auth-1.251 { db authorizer ::auth proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_ATTACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] } return SQLITE_OK } catchsql { ATTACH DATABASE ':memory:' AS test1 } } {0 {}} do_test auth-1.252 { set ::authargs } {:memory: {} {} {}} do_test auth-1.253 { catchsql {DETACH DATABASE test1} proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_ATTACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql { ATTACH DATABASE ':memory:' AS test1; } } {1 {not authorized}} do_test auth-1.254 { lindex [execsql {PRAGMA database_list}] 7 } {} do_test auth-1.255 { catchsql {DETACH DATABASE test1} proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_ATTACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql { ATTACH DATABASE ':memory:' AS test1; } } {0 {}} do_test auth-1.256 { lindex [execsql {PRAGMA database_list}] 7 } {} do_test auth-1.257 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DETACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } return SQLITE_OK } execsql {ATTACH DATABASE ':memory:' AS test1} catchsql { DETACH DATABASE test1; } } {0 {}} do_test auth-1.258 { lindex [execsql {PRAGMA database_list}] 7 } {} do_test auth-1.259 { execsql {ATTACH DATABASE ':memory:' AS test1} proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DETACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_IGNORE } return SQLITE_OK } catchsql { DETACH DATABASE test1; } } {0 {}} do_test auth-1.260 { lindex [execsql {PRAGMA database_list}] 7 } {test1} do_test auth-1.261 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_DETACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql { DETACH DATABASE test1; } } {1 {not authorized}} do_test auth-1.262 { lindex [execsql {PRAGMA database_list}] 7 } {test1} db authorizer {} execsql {DETACH DATABASE test1} do_test auth-2.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} { return SQLITE_DENY } return SQLITE_OK } db authorizer ::auth execsql {CREATE TABLE t3(x INTEGER PRIMARY KEY, y, z)} catchsql {SELECT * FROM t3} } {1 {access to t3.x is prohibited}} do_test auth-2.1 { catchsql {SELECT y,z FROM t3} } {0 {}} do_test auth-2.2 { catchsql {SELECT ROWID,y,z FROM t3} } {1 {access to t3.x is prohibited}} do_test auth-2.3 { catchsql {SELECT OID,y,z FROM t3} } {1 {access to t3.x is prohibited}} do_test auth-2.4 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} { return SQLITE_IGNORE } return SQLITE_OK } execsql {INSERT INTO t3 VALUES(44,55,66)} catchsql {SELECT * FROM t3} } {0 {{} 55 66}} do_test auth-2.5 { catchsql {SELECT rowid,y,z FROM t3} } {0 {{} 55 66}} do_test auth-2.6 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="ROWID"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t3} } {0 {44 55 66}} do_test auth-2.7 { catchsql {SELECT ROWID,y,z FROM t3} } {0 {44 55 66}} do_test auth-2.8 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="ROWID"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT ROWID,b,c FROM t2} } {0 {{} 2 33 {} 8 9}} do_test auth-2.9.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="ROWID"} { return bogus } return SQLITE_OK } catchsql {SELECT ROWID,b,c FROM t2} } {1 {illegal return value (999) from the authorization function - should be SQLITE_OK, SQLITE_IGNORE, or SQLITE_DENY}} do_test auth-2.9.2 { db errorcode } {21} do_test auth-2.10 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_SELECT"} { return bogus } return SQLITE_OK } catchsql {SELECT ROWID,b,c FROM t2} } {1 {illegal return value (1) from the authorization function - should be SQLITE_OK, SQLITE_IGNORE, or SQLITE_DENY}} do_test auth-2.11.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg2=="a"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2, t3} } {0 {{} 2 33 44 55 66 {} 8 9 44 55 66}} do_test auth-2.11.2 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg2=="x"} { return SQLITE_IGNORE } return SQLITE_OK } catchsql {SELECT * FROM t2, t3} } {0 {11 2 33 {} 55 66 7 8 9 {} 55 66}} # Make sure the OLD and NEW pseudo-tables of a trigger get authorized. # do_test auth-3.1 { proc auth {code arg1 arg2 arg3 arg4} { return SQLITE_OK } execsql { CREATE TABLE tx(a1,a2,b1,b2,c1,c2); CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN INSERT INTO tx VALUES(OLD.a,NEW.a,OLD.b,NEW.b,OLD.c,NEW.c); END; UPDATE t2 SET a=a+1; SELECT * FROM tx; } } {11 12 2 2 33 33 7 8 8 8 9 9} do_test auth-3.2 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="c"} { return SQLITE_IGNORE } return SQLITE_OK } execsql { DELETE FROM tx; UPDATE t2 SET a=a+100; SELECT * FROM tx; } } {12 112 2 2 {} {} 8 108 8 8 {} {}} # Make sure the names of views and triggers are passed on on arg4. # do_test auth-4.1 { proc auth {code arg1 arg2 arg3 arg4} { lappend ::authargs $code $arg1 $arg2 $arg3 $arg4 return SQLITE_OK } set authargs {} execsql { UPDATE t2 SET a=a+1; } set authargs } [list \ SQLITE_READ t2 a main {} \ SQLITE_UPDATE t2 a main {} \ SQLITE_INSERT tx {} main r1 \ SQLITE_READ t2 a main r1 \ SQLITE_READ t2 a main r1 \ SQLITE_READ t2 b main r1 \ SQLITE_READ t2 b main r1 \ SQLITE_READ t2 c main r1 \ SQLITE_READ t2 c main r1] do_test auth-4.2 { execsql { CREATE VIEW v1 AS SELECT a+b AS x FROM t2; CREATE TABLE v1chng(x1,x2); CREATE TRIGGER r2 INSTEAD OF UPDATE ON v1 BEGIN INSERT INTO v1chng VALUES(OLD.x,NEW.x); END; SELECT * FROM v1; } } {115 117} do_test auth-4.3 { set authargs {} execsql { UPDATE v1 SET x=1 WHERE x=117 } set authargs } [list \ SQLITE_UPDATE v1 x main {} \ SQLITE_READ v1 x main {} \ SQLITE_SELECT {} {} {} v1 \ SQLITE_READ t2 a main v1 \ SQLITE_READ t2 b main v1 \ SQLITE_INSERT v1chng {} main r2 \ SQLITE_READ v1 x main r2 \ SQLITE_READ v1 x main r2] do_test auth-4.4 { execsql { CREATE TRIGGER r3 INSTEAD OF DELETE ON v1 BEGIN INSERT INTO v1chng VALUES(OLD.x,NULL); END; SELECT * FROM v1; } } {115 117} do_test auth-4.5 { set authargs {} execsql { DELETE FROM v1 WHERE x=117 } set authargs } [list \ SQLITE_DELETE v1 {} main {} \ SQLITE_READ v1 x main {} \ SQLITE_SELECT {} {} {} v1 \ SQLITE_READ t2 a main v1 \ SQLITE_READ t2 b main v1 \ SQLITE_INSERT v1chng {} main r3 \ SQLITE_READ v1 x main r3] finish_test sqlite-2.8.17/test/vacuum.test0000644000175000001440000001035710232547612016236 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the VACUUM statement. # # $Id: vacuum.test,v 1.15 2004/02/14 16:31:04 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl proc cksum {{db db}} { set txt [$db eval {SELECT name, type, sql FROM sqlite_master}]\n foreach tbl [$db eval {SELECT name FROM sqlite_master WHERE type='table'}] { append txt [$db eval "SELECT * FROM $tbl"]\n } foreach prag {default_synchronous default_cache_size} { append txt $prag-[$db eval "PRAGMA $prag"]\n } set cksum [string length $txt]-[md5 $txt] # puts $cksum-[file size test.db] return $cksum } do_test vacuum-1.1 { execsql { BEGIN; CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); INSERT INTO t1 VALUES(NULL,randstr(10,100),randstr(5,50)); INSERT INTO t1 VALUES(123456,randstr(10,100),randstr(5,50)); INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; INSERT INTO t1 SELECT NULL, b||'-'||rowid, c||'-'||rowid FROM t1; CREATE INDEX i1 ON t1(b,c); CREATE TABLE t2 AS SELECT * FROM t1; COMMIT; DROP TABLE t2; } set ::size1 [file size test.db] set ::cksum [cksum] expr {$::cksum!=""} } {1} do_test vacuum-1.2 { execsql { VACUUM; } cksum } $cksum do_test vacuum-1.3 { expr {[file size test.db]<$::size1} } {1} do_test vacuum-1.4 { execsql { BEGIN; CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t3 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT b, c FROM t3; CREATE TRIGGER r1 AFTER DELETE ON t2 BEGIN SELECT 1; END; COMMIT; DROP TABLE t2; } set ::size1 [file size test.db] set ::cksum [cksum] expr {$::cksum!=""} } {1} do_test vacuum-1.5 { execsql { VACUUM; } cksum } $cksum do_test vacuum-1.6 { expr {[file size test.db]<$::size1} } {1} do_test vacuum-2.1 { catchsql { BEGIN; VACUUM; COMMIT; } } {1 {cannot VACUUM from within a transaction}} catch {db eval COMMIT} do_test vacuum-2.2 { sqlite db2 test.db execsql { BEGIN; CREATE TABLE t4 AS SELECT * FROM t1; CREATE TABLE t5 AS SELECT * FROM t1; COMMIT; DROP TABLE t4; DROP TABLE t5; } db2 set ::cksum [cksum db2] catchsql { VACUUM } } {0 {}} do_test vacuum-2.3 { cksum } $cksum do_test vacuum-2.4 { catch {db2 eval {SELECT count(*) FROM sqlite_master}} cksum db2 } $cksum # Ticket #427. Make sure VACUUM works when the EMPTY_RESULT_CALLBACKS # pragma is turned on. # do_test vacuum-3.1 { db close db2 close file delete test.db sqlite db test.db execsql { PRAGMA empty_result_callbacks=on; VACUUM; } } {} # Ticket #464. Make sure VACUUM works with the sqlite_compile() API. # do_test vacuum-4.1 { db close set DB [sqlite db test.db] set VM [sqlite_compile $DB {VACUUM} TAIL] sqlite_step $VM N VALUES COLNAMES } {SQLITE_DONE} do_test vacuum-4.2 { sqlite_finalize $VM } {} # Ticket #515. VACUUM after deleting and recreating the table that # a view refers to. # do_test vacuum-5.1 { db close file delete -force test.db sqlite db test.db catchsql { CREATE TABLE Test (TestID int primary key); INSERT INTO Test VALUES (NULL); CREATE VIEW viewTest AS SELECT * FROM Test; BEGIN; CREATE TEMP TABLE tempTest (TestID int primary key, Test2 int NULL); INSERT INTO tempTest SELECT TestID, 1 FROM Test; DROP TABLE Test; CREATE TABLE Test(TestID int primary key, Test2 int NULL); INSERT INTO Test SELECT * FROM tempTest; COMMIT; VACUUM; } } {0 {}} do_test vacuum-5.2 { catchsql { VACUUM; } } {0 {}} # finish_test sqlite-2.8.17/test/tclsqlite.test0000644000175000001440000000643510232547612016744 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for TCL interface to the # SQLite library. # # Actually, all tests are based on the TCL interface, so the main # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # # $Id: tclsqlite.test,v 1.20.2.1 2004/07/19 19:30:50 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Check the error messages generated by tclsqlite # if {[sqlite -has-codec]} { set r "sqlite_orig HANDLE FILENAME ?-key CODEC-KEY?" } else { set r "sqlite HANDLE FILENAME ?MODE?" } do_test tcl-1.1 { set v [catch {sqlite bogus} msg] lappend v $msg } [list 1 "wrong # args: should be \"$r\""] do_test tcl-1.2 { set v [catch {db bogus} msg] lappend v $msg } {1 {bad option "bogus": must be authorizer, busy, changes, close, commit_hook, complete, errorcode, eval, function, last_insert_rowid, last_statement_changes, onecolumn, progress, rekey, timeout, or trace}} do_test tcl-1.3 { execsql {CREATE TABLE t1(a int, b int)} execsql {INSERT INTO t1 VALUES(10,20)} set v [catch { db eval {SELECT * FROM t1} data { error "The error message" } } msg] lappend v $msg } {1 {The error message}} do_test tcl-1.4 { set v [catch { db eval {SELECT * FROM t2} data { error "The error message" } } msg] lappend v $msg } {1 {no such table: t2}} do_test tcl-1.5 { set v [catch { db eval {SELECT * FROM t1} data { break } } msg] lappend v $msg } {0 {}} do_test tcl-1.6 { set v [catch { db eval {SELECT * FROM t1} data { expr x* } } msg] regsub {:.*$} $msg {} msg lappend v $msg } {1 {syntax error in expression "x*"}} if {[sqlite -encoding]=="UTF-8" && [sqlite -tcl-uses-utf]} { catch {unset ::result} do_test tcl-2.1 { execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" execsql "PRAGMA table_info(t\u0123x)" } "0 a int 0 {} 0 1 b\u1235 float 0 {} 0" do_test tcl-2.2 { execsql "INSERT INTO t\u0123x VALUES(1,2.3)" db eval "SELECT * FROM t\u0123x" result break set result(*) } "a b\u1235" } if {[sqlite -encoding]=="iso8859" && [sqlite -tcl-uses-utf]} { do_test tcl-2.1 { execsql "CREATE TABLE t\251x(a int, b\306 float)" execsql "PRAGMA table_info(t\251x)" } "0 a int 0 {} 0 1 b\306 float 0 {} 0" do_test tcl-2.2 { execsql "INSERT INTO t\251x VALUES(1,2.3)" db eval "SELECT * FROM t\251x" result break set result(*) } "a b\306" } # Test the onecolumn method # do_test tcl-3.1 { execsql { INSERT INTO t1 SELECT a*2, b*2 FROM t1; INSERT INTO t1 SELECT a*2+1, b*2+1 FROM t1; INSERT INTO t1 SELECT a*2+3, b*2+3 FROM t1; } set rc [catch {db onecolumn {SELECT * FROM t1 ORDER BY a}} msg] lappend rc $msg } {0 10} do_test tcl-3.2 { db onecolumn {SELECT * FROM t1 WHERE a<0} } {} do_test tcl-3.3 { set rc [catch {db onecolumn} errmsg] lappend rc $errmsg } {1 {wrong # args: should be "db onecolumn SQL"}} finish_test sqlite-2.8.17/test/join4_28.test0000644000175000001440000000440610232547612016270 0ustar drhusers00000000000000# 2002 May 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for left outer joins containing WHERE # clauses that restrict the scope of the left term of the join. # # $Id: join4_28.test,v 1.1.2.1 2004/07/22 16:08:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test join4-1.1 { execsql { create temp table t1(a integer, b varchar(10)); insert into t1 values(1,'one'); insert into t1 values(2,'two'); insert into t1 values(3,'three'); insert into t1 values(4,'four'); create temp table t2(x integer, y varchar(10), z varchar(10)); insert into t2 values(2,'niban','ok'); insert into t2 values(4,'yonban','err'); } execsql { select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok' } } {2 two 2 niban ok} do_test join4-1.2 { execsql { select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok' } } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}} do_test join4-1.3 { execsql { create index i2 on t2(z); } execsql { select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok' } } {2 two 2 niban ok} do_test join4-1.4 { execsql { select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok' } } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}} do_test join4-1.5 { execsql { select * from t1 left outer join t2 on t1.a=t2.x where t2.z>='ok' } } {2 two 2 niban ok} do_test join4-1.4 { execsql { select * from t1 left outer join t2 on t1.a=t2.x and t2.z>='ok' } } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}} do_test join4-1.6 { execsql { select * from t1 left outer join t2 on t1.a=t2.x where t2.z IN ('ok') } } {2 two 2 niban ok} do_test join4-1.7 { execsql { select * from t1 left outer join t2 on t1.a=t2.x and t2.z IN ('ok') } } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}} finish_test sqlite-2.8.17/test/btree2.test0000644000175000001440000003111110232547612016110 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # $Id: btree2.test,v 1.10 2002/02/19 13:39:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Create a new database file containing no entries. The database should # contain 5 tables: # # 2 The descriptor table # 3 The foreground table # 4 The background table # 5 The long key table # 6 The long data table # # An explanation for what all these tables are used for is provided below. # do_test btree2-1.1 { expr srand(1) file delete -force test2.bt file delete -force test2.bt-journal set ::b [btree_open test2.bt] btree_begin_transaction $::b btree_create_table $::b } {3} do_test btree2-1.2 { btree_create_table $::b } {4} do_test btree2-1.3 { btree_create_table $::b } {5} do_test btree2-1.4 { btree_create_table $::b } {6} do_test btree2-1.5 { set ::c2 [btree_cursor $::b 2 1] btree_insert $::c2 {one} {1} btree_delete $::c2 btree_close_cursor $::c2 btree_commit $::b btree_integrity_check $::b 2 3 4 5 6 } {} # This test module works by making lots of pseudo-random changes to a # database while simultaneously maintaining an invariant on that database. # Periodically, the script does a sanity check on the database and verifies # that the invariant is satisfied. # # The invariant is as follows: # # 1. The descriptor table always contains 2 enters. An entry keyed by # "N" is the number of elements in the foreground and background tables # combined. The entry keyed by "L" is the number of digits in the keys # for foreground and background tables. # # 2. The union of the foreground an background tables consists of N entries # where each entry an L-digit key. (Actually, some keys can be longer # than L characters, but they always start with L digits.) The keys # cover all integers between 1 and N. Whenever an entry is added to # the foreground it is removed form the background and vice versa. # # 3. Some entries in the foreground and background tables have keys that # begin with an L-digit number but are followed by additional characters. # For each such entry there is a corresponding entry in the long key # table. The long key table entry has a key which is just the L-digit # number and data which is the length of the key in the foreground and # background tables. # # 4. The data for both foreground and background entries is usually a # short string. But some entries have long data strings. For each # such entries there is an entry in the long data type. The key to # long data table is an L-digit number. (The extension on long keys # is omitted.) The data is the number of charaters in the data of the # foreground or background entry. # # The following function builds a database that satisfies all of the above # invariants. # proc build_db {N L} { for {set i 2} {$i<=6} {incr i} { catch {btree_close_cursor [set ::c$i]} btree_clear_table $::b $i set ::c$i [btree_cursor $::b $i 1] } btree_insert $::c2 N $N btree_insert $::c2 L $L set format %0${L}d for {set i 1} {$i<=$N} {incr i} { set key [format $format $i] set data $key btree_insert $::c3 $key $data } } # Given a base key number and a length, construct the full text of the key # or data. # proc make_payload {keynum L len} { set key [format %0${L}d $keynum] set r $key set i 1 while {[string length $r]<$len} { append r " ($i) $key" incr i } return [string range $r 0 [expr {$len-1}]] } # Verify the invariants on the database. Return an empty string on # success or an error message if something is amiss. # proc check_invariants {} { set ck [btree_integrity_check $::b 2 3 4 5 6] if {$ck!=""} { puts "\n*** SANITY:\n$ck" exit return $ck } btree_move_to $::c3 {} btree_move_to $::c4 {} btree_move_to $::c2 N set N [btree_data $::c2] btree_move_to $::c2 L set L [btree_data $::c2] set LM1 [expr {$L-1}] for {set i 1} {$i<=$N} {incr i} { set key [btree_key $::c3] if {[scan $key %d k]<1} {set k 0} if {$k!=$i} { set key [btree_key $::c4] if {[scan $key %d k]<1} {set k 0} if {$k!=$i} { # puts "MISSING $i" # puts {Page 3:}; btree_page_dump $::b 3 # puts {Page 4:}; btree_page_dump $::b 4 # exit return "Key $i is missing from both foreground and background" } set data [btree_data $::c4] btree_next $::c4 } else { set data [btree_data $::c3] btree_next $::c3 } set skey [string range $key 0 $LM1] if {[btree_move_to $::c5 $skey]==0} { set keylen [btree_data $::c5] } else { set keylen $L } if {[string length $key]!=$keylen} { return "Key $i is the wrong size.\ Is \"$key\" but should be \"[make_payload $k $L $keylen]\"" } if {[make_payload $k $L $keylen]!=$key} { return "Key $i has an invalid extension" } if {[btree_move_to $::c6 $skey]==0} { set datalen [btree_data $::c6] } else { set datalen $L } if {[string length $data]!=$datalen} { return "Data for $i is the wrong size.\ Is [string length $data] but should be $datalen" } if {[make_payload $k $L $datalen]!=$data} { return "Entry $i has an incorrect data" } } } # Make random changes to the database such that each change preserves # the invariants. The number of changes is $n*N where N is the parameter # from the descriptor table. Each changes begins with a random key. # the entry with that key is put in the foreground table with probability # $I and it is put in background with probability (1.0-$I). It gets # a long key with probability $K and long data with probability $D. # set chngcnt 0 proc random_changes {n I K D} { btree_move_to $::c2 N set N [btree_data $::c2] btree_move_to $::c2 L set L [btree_data $::c2] set LM1 [expr {$L-1}] set total [expr {int($N*$n)}] set format %0${L}d for {set i 0} {$i<$total} {incr i} { set k [expr {int(rand()*$N)+1}] set insert [expr {rand()<=$I}] set longkey [expr {rand()<=$K}] set longdata [expr {rand()<=$D}] # incr ::chngcnt # if {$::chngcnt==251} {btree_tree_dump $::b 3} # puts "CHANGE $::chngcnt: $k $insert $longkey $longdata" if {$longkey} { set x [expr {rand()}] set keylen [expr {int($x*$x*$x*$x*3000)+10}] } else { set keylen $L } set key [make_payload $k $L $keylen] if {$longdata} { set x [expr {rand()}] set datalen [expr {int($x*$x*$x*$x*3000)+10}] } else { set datalen $L } set data [make_payload $k $L $datalen] set basekey [format $format $k] if {[set c [btree_move_to $::c3 $basekey]]==0} { btree_delete $::c3 } else { if {$c<0} {btree_next $::c3} if {[string match $basekey* [btree_key $::c3]]} { btree_delete $::c3 } } if {[set c [btree_move_to $::c4 $basekey]]==0} { btree_delete $::c4 } else { if {$c<0} {btree_next $::c4} if {[string match $basekey* [btree_key $::c4]]} { btree_delete $::c4 } } if {[scan [btree_key $::c4] %d kx]<1} {set kx -1} if {$kx==$k} { btree_delete $::c4 } if {$insert} { btree_insert $::c3 $key $data } else { btree_insert $::c4 $key $data } if {$longkey} { btree_insert $::c5 $basekey $keylen } elseif {[btree_move_to $::c5 $basekey]==0} { btree_delete $::c5 } if {$longdata} { btree_insert $::c6 $basekey $datalen } elseif {[btree_move_to $::c6 $basekey]==0} { btree_delete $::c6 } # set ck [btree_integrity_check $::b 2 3 4 5 6] # if {$ck!=""} { # puts "\nSANITY CHECK FAILED!\n$ck" # exit # } # puts "PAGE 3:"; btree_page_dump $::b 3 # puts "PAGE 4:"; btree_page_dump $::b 4 } } # Repeat this test sequence on database of various sizes # set testno 2 foreach {N L} { 10 2 50 2 200 3 2000 5 } { puts "**** N=$N L=$L ****" set hash [md5file test2.bt] do_test btree2-$testno.1 [subst -nocommands { set ::c2 [btree_cursor $::b 2 1] set ::c3 [btree_cursor $::b 3 1] set ::c4 [btree_cursor $::b 4 1] set ::c5 [btree_cursor $::b 5 1] set ::c6 [btree_cursor $::b 6 1] btree_begin_transaction $::b build_db $N $L check_invariants }] {} do_test btree2-$testno.2 { btree_close_cursor $::c2 btree_close_cursor $::c3 btree_close_cursor $::c4 btree_close_cursor $::c5 btree_close_cursor $::c6 btree_rollback $::b md5file test2.bt } $hash do_test btree2-$testno.3 [subst -nocommands { btree_begin_transaction $::b set ::c2 [btree_cursor $::b 2 1] set ::c3 [btree_cursor $::b 3 1] set ::c4 [btree_cursor $::b 4 1] set ::c5 [btree_cursor $::b 5 1] set ::c6 [btree_cursor $::b 6 1] build_db $N $L check_invariants }] {} do_test btree2-$testno.4 { btree_commit $::b check_invariants } {} do_test btree2-$testno.5 { lindex [btree_pager_stats $::b] 1 } {6} do_test btree2-$testno.6 { btree_close_cursor $::c2 btree_close_cursor $::c3 btree_close_cursor $::c4 btree_close_cursor $::c5 btree_close_cursor $::c6 lindex [btree_pager_stats $::b] 1 } {0} do_test btree2-$testno.7 { btree_close $::b } {} after 100 # For each database size, run various changes tests. # set num2 1 foreach {n I K D} { 0.5 0.5 0.1 0.1 1.0 0.2 0.1 0.1 1.0 0.8 0.1 0.1 2.0 0.0 0.1 0.1 2.0 1.0 0.1 0.1 2.0 0.0 0.0 0.0 2.0 1.0 0.0 0.0 } { set testid btree2-$testno.8.$num2 set hash [md5file test2.bt] do_test $testid.0 { set ::b [btree_open test2.bt] set ::c2 [btree_cursor $::b 2 1] set ::c3 [btree_cursor $::b 3 1] set ::c4 [btree_cursor $::b 4 1] set ::c5 [btree_cursor $::b 5 1] set ::c6 [btree_cursor $::b 6 1] check_invariants } {} set cnt 6 for {set i 2} {$i<=6} {incr i} { if {[lindex [btree_cursor_dump [set ::c$i]] 0]!=$i} {incr cnt} } do_test $testid.1 { btree_begin_transaction $::b lindex [btree_pager_stats $::b] 1 } $cnt # exec cp test2.bt test2.bt.bu1 do_test $testid.2 [subst { random_changes $n $I $K $D }] {} do_test $testid.3 { check_invariants } {} do_test $testid.4 { btree_close_cursor $::c2 btree_close_cursor $::c3 btree_close_cursor $::c4 btree_close_cursor $::c5 btree_close_cursor $::c6 btree_rollback $::b md5file test2.bt } $hash # exec cp test2.bt test2.bt.bu2 btree_begin_transaction $::b set ::c2 [btree_cursor $::b 2 1] set ::c3 [btree_cursor $::b 3 1] set ::c4 [btree_cursor $::b 4 1] set ::c5 [btree_cursor $::b 5 1] set ::c6 [btree_cursor $::b 6 1] do_test $testid.5 [subst { random_changes $n $I $K $D }] {} do_test $testid.6 { check_invariants } {} do_test $testid.7 { btree_commit $::b check_invariants } {} set hash [md5file test2.bt] do_test $testid.8 { btree_close_cursor $::c2 btree_close_cursor $::c3 btree_close_cursor $::c4 btree_close_cursor $::c5 btree_close_cursor $::c6 lindex [btree_pager_stats $::b] 1 } {0} do_test $testid.9 { btree_close $::b set ::b [btree_open test2.bt] set ::c2 [btree_cursor $::b 2 1] set ::c3 [btree_cursor $::b 3 1] set ::c4 [btree_cursor $::b 4 1] set ::c5 [btree_cursor $::b 5 1] set ::c6 [btree_cursor $::b 6 1] check_invariants } {} do_test $testid.10 { btree_close_cursor $::c2 btree_close_cursor $::c3 btree_close_cursor $::c4 btree_close_cursor $::c5 btree_close_cursor $::c6 lindex [btree_pager_stats $::b] 1 } {0} do_test $testid.11 { btree_close $::b } {} incr num2 } incr testno set ::b [btree_open test2.bt] } # Testing is complete. Shut everything down. # do_test btree-999.1 { lindex [btree_pager_stats $::b] 1 } {0} do_test btree-999.2 { btree_close $::b } {} do_test btree-999.3 { file delete -force test2.bt file exists test2.bt-journal } {0} } ;# end if( not mem: and has pager_open command ); finish_test sqlite-2.8.17/test/btree3.test0000644000175000001440000000455710232547612016127 0ustar drhusers00000000000000# 2001 November 22 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # In particular, this file tests a small part of the Delete logic # for the BTree backend. When a row is deleted from a table, the # cursor is suppose to be left pointing at either the previous or # next entry in that table. If the cursor is left pointing at the # next entry, then the next Next operation is ignored. So the # sequence of operations (Delete, Next) should always leave the # cursor pointing at the first entry past the one that was deleted. # This test is designed to verify that behavior. # # $Id: btree3.test,v 1.2 2002/12/04 13:40:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Open a test database. # file delete -force test1.bt file delete -force test1.bt-journal set b1 [btree_open test1.bt] btree_begin_transaction $::b1 # Insert a few one records # set data {abcdefghijklmnopqrstuvwxyz0123456789} append data $data append data $data append data $data append data $data for {set k 2} {$k<=10} {incr k} { for {set j 1} {$j<=$k} {incr j} { set jkey [format %02d $j] btree_clear_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] for {set i 1} {$i<=$k} {incr i} { set key [format %02d $i] do_test btree3-$k.$j.1.$i { btree_insert $::c1 $::key $::data } {} # btree_tree_dump $::b1 2 } do_test btree3-$k.$j.2 { btree_move_to $::c1 $::jkey btree_key $::c1 } $::jkey do_test btree3-$k.$j.3 { btree_delete $::c1 } {} if {$j<$k} { do_test btree3-$k.$j.4 { btree_next $::c1 btree_key $::c1 } [format %02d [expr $j+1]] } if {$j>1} { do_test btree3-$k.$j.5 { btree_prev $::c1 btree_key $::c1 } [format %02d [expr $j-1]] } btree_close_cursor $::c1 } } btree_rollback $::b1 btree_pager_ref_dump $::b1 btree_close $::b1 } ;# end if( not mem: and has pager_open command ); finish_test sqlite-2.8.17/test/delete.test0000644000175000001440000001634210232547612016200 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the DELETE FROM statement. # # $Id: delete.test,v 1.13 2003/06/15 23:42:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to delete from a non-existant table. # do_test delete-1.1 { set v [catch {execsql {DELETE FROM test1}} msg] lappend v $msg } {1 {no such table: test1}} # Try to delete from sqlite_master # do_test delete-2.1 { set v [catch {execsql {DELETE FROM sqlite_master}} msg] lappend v $msg } {1 {table sqlite_master may not be modified}} # Delete selected entries from a table with and without an index. # do_test delete-3.1.1 { execsql {CREATE TABLE table1(f1 int, f2 int)} execsql {INSERT INTO table1 VALUES(1,2)} execsql {INSERT INTO table1 VALUES(2,4)} execsql {INSERT INTO table1 VALUES(3,8)} execsql {INSERT INTO table1 VALUES(4,16)} execsql {SELECT * FROM table1 ORDER BY f1} } {1 2 2 4 3 8 4 16} do_test delete-3.1.2 { execsql {DELETE FROM table1 WHERE f1=3} } {} do_test delete-3.1.3 { execsql {SELECT * FROM table1 ORDER BY f1} } {1 2 2 4 4 16} do_test delete-3.1.4 { execsql {CREATE INDEX index1 ON table1(f1)} execsql {PRAGMA count_changes=on} execsql {DELETE FROM 'table1' WHERE f1=3} } {0} do_test delete-3.1.5 { execsql {SELECT * FROM table1 ORDER BY f1} } {1 2 2 4 4 16} do_test delete-3.1.6 { execsql {DELETE FROM table1 WHERE f1=2} } {1} do_test delete-3.1.7 { execsql {SELECT * FROM table1 ORDER BY f1} } {1 2 4 16} integrity_check delete-3.2 # Semantic errors in the WHERE clause # do_test delete-4.1 { execsql {CREATE TABLE table2(f1 int, f2 int)} set v [catch {execsql {DELETE FROM table2 WHERE f3=5}} msg] lappend v $msg } {1 {no such column: f3}} do_test delete-4.2 { set v [catch {execsql {DELETE FROM table2 WHERE xyzzy(f1+4)}} msg] lappend v $msg } {1 {no such function: xyzzy}} integrity_check delete-4.3 # Lots of deletes # do_test delete-5.1.1 { execsql {DELETE FROM table1} } {2} do_test delete-5.1.2 { execsql {SELECT count(*) FROM table1} } {0} do_test delete-5.2.1 { execsql {BEGIN TRANSACTION} for {set i 1} {$i<=200} {incr i} { execsql "INSERT INTO table1 VALUES($i,[expr {$i*$i}])" } execsql {COMMIT} execsql {SELECT count(*) FROM table1} } {200} do_test delete-5.2.2 { execsql {DELETE FROM table1} } {200} do_test delete-5.2.3 { execsql {BEGIN TRANSACTION} for {set i 1} {$i<=200} {incr i} { execsql "INSERT INTO table1 VALUES($i,[expr {$i*$i}])" } execsql {COMMIT} execsql {SELECT count(*) FROM table1} } {200} do_test delete-5.2.4 { execsql {PRAGMA count_changes=off} execsql {DELETE FROM table1} } {} do_test delete-5.2.5 { execsql {SELECT count(*) FROM table1} } {0} do_test delete-5.2.6 { execsql {BEGIN TRANSACTION} for {set i 1} {$i<=200} {incr i} { execsql "INSERT INTO table1 VALUES($i,[expr {$i*$i}])" } execsql {COMMIT} execsql {SELECT count(*) FROM table1} } {200} do_test delete-5.3 { for {set i 1} {$i<=200} {incr i 4} { execsql "DELETE FROM table1 WHERE f1==$i" } execsql {SELECT count(*) FROM table1} } {150} do_test delete-5.4 { execsql "DELETE FROM table1 WHERE f1>50" execsql {SELECT count(*) FROM table1} } {37} do_test delete-5.5 { for {set i 1} {$i<=70} {incr i 3} { execsql "DELETE FROM table1 WHERE f1==$i" } execsql {SELECT f1 FROM table1 ORDER BY f1} } {2 3 6 8 11 12 14 15 18 20 23 24 26 27 30 32 35 36 38 39 42 44 47 48 50} do_test delete-5.6 { for {set i 1} {$i<40} {incr i} { execsql "DELETE FROM table1 WHERE f1==$i" } execsql {SELECT f1 FROM table1 ORDER BY f1} } {42 44 47 48 50} do_test delete-5.7 { execsql "DELETE FROM table1 WHERE f1!=48" execsql {SELECT f1 FROM table1 ORDER BY f1} } {48} integrity_check delete-5.8 # Delete large quantities of data. We want to test the List overflow # mechanism in the vdbe. # do_test delete-6.1 { set fd [open data1.txt w] for {set i 1} {$i<=3000} {incr i} { puts $fd "[expr {$i}]\t[expr {$i*$i}]" } close $fd execsql {DELETE FROM table1} execsql {COPY table1 FROM 'data1.txt'} execsql {DELETE FROM table2} execsql {COPY table2 FROM 'data1.txt'} file delete data1.txt execsql {SELECT count(*) FROM table1} } {3000} do_test delete-6.2 { execsql {SELECT count(*) FROM table2} } {3000} do_test delete-6.3 { execsql {SELECT f1 FROM table1 WHERE f1<10 ORDER BY f1} } {1 2 3 4 5 6 7 8 9} do_test delete-6.4 { execsql {SELECT f1 FROM table2 WHERE f1<10 ORDER BY f1} } {1 2 3 4 5 6 7 8 9} do_test delete-6.5 { execsql {DELETE FROM table1 WHERE f1>7} execsql {SELECT f1 FROM table1 ORDER BY f1} } {1 2 3 4 5 6 7} do_test delete-6.6 { execsql {DELETE FROM table2 WHERE f1>7} execsql {SELECT f1 FROM table2 ORDER BY f1} } {1 2 3 4 5 6 7} do_test delete-6.7 { execsql {DELETE FROM table1} execsql {SELECT f1 FROM table1} } {} do_test delete-6.8 { execsql {INSERT INTO table1 VALUES(2,3)} execsql {SELECT f1 FROM table1} } {2} do_test delete-6.9 { execsql {DELETE FROM table2} execsql {SELECT f1 FROM table2} } {} do_test delete-6.10 { execsql {INSERT INTO table2 VALUES(2,3)} execsql {SELECT f1 FROM table2} } {2} integrity_check delete-6.11 do_test delete-7.1 { execsql { CREATE TABLE t3(a); INSERT INTO t3 VALUES(1); INSERT INTO t3 SELECT a+1 FROM t3; INSERT INTO t3 SELECT a+2 FROM t3; SELECT * FROM t3; } } {1 2 3 4} do_test delete-7.2 { execsql { CREATE TABLE cnt(del); INSERT INTO cnt VALUES(0); CREATE TRIGGER r1 AFTER DELETE ON t3 FOR EACH ROW BEGIN UPDATE cnt SET del=del+1; END; DELETE FROM t3 WHERE a<2; SELECT * FROM t3; } } {2 3 4} do_test delete-7.3 { execsql { SELECT * FROM cnt; } } {1} do_test delete-7.4 { execsql { DELETE FROM t3; SELECT * FROM t3; } } {} do_test delete-7.5 { execsql { SELECT * FROM cnt; } } {4} do_test delete-7.6 { execsql { INSERT INTO t3 VALUES(1); INSERT INTO t3 SELECT a+1 FROM t3; INSERT INTO t3 SELECT a+2 FROM t3; CREATE TABLE t4 AS SELECT * FROM t3; PRAGMA count_changes=ON; DELETE FROM t3; DELETE FROM t4; } } {4 4} integrity_check delete-7.7 # Make sure error messages are consistent when attempting to delete # from a read-only database. Ticket #304. # do_test delete-8.0 { execsql { PRAGMA count_changes=OFF; INSERT INTO t3 VALUES(123); SELECT * FROM t3; } } {123} db close catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} sqlite db test.db do_test delete-8.1 { catchsql { DELETE FROM t3; } } {1 {attempt to write a readonly database}} do_test delete-8.2 { execsql {SELECT * FROM t3} } {123} do_test delete-8.3 { catchsql { DELETE FROM t3 WHERE 1; } } {1 {attempt to write a readonly database}} do_test delete-8.4 { execsql {SELECT * FROM t3} } {123} do_test delete-8.5 { catchsql { DELETE FROM t3 WHERE a<100; } } {0 {}} do_test delete-8.6 { execsql {SELECT * FROM t3} } {123} integrity_check delete-8.7 finish_test sqlite-2.8.17/test/btree4.test0000644000175000001440000000450710232547612016123 0ustar drhusers00000000000000# 2002 December 03 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # This file focuses on testing the sqliteBtreeNext() and # sqliteBtreePrevious() procedures and making sure they are able # to step through an entire table from either direction. # # $Id: btree4.test,v 1.1 2002/12/04 13:40:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Open a test database. # file delete -force test1.bt file delete -force test1.bt-journal set b1 [btree_open test1.bt] btree_begin_transaction $::b1 set data {abcdefghijklmnopqrstuvwxyz0123456789} append data $data append data $data append data $data append data $data foreach N {10 100 1000} { btree_clear_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] do_test btree4-$N.1 { for {set i 1} {$i<=$N} {incr i} { btree_insert $::c1 [format k-%05d $i] $::data-$i } btree_first $::c1 btree_key $::c1 } {k-00001} do_test btree4-$N.2 { btree_data $::c1 } $::data-1 for {set i 2} {$i<=$N} {incr i} { do_test btree-$N.3.$i.1 { btree_next $::c1 } 0 do_test btree-$N.3.$i.2 { btree_key $::c1 } [format k-%05d $i] do_test btree-$N.3.$i.3 { btree_data $::c1 } $::data-$i } do_test btree4-$N.4 { btree_next $::c1 } 1 do_test btree4-$N.5 { btree_last $::c1 } 0 do_test btree4-$N.6 { btree_key $::c1 } [format k-%05d $N] do_test btree4-$N.7 { btree_data $::c1 } $::data-$N for {set i [expr {$N-1}]} {$i>=1} {incr i -1} { do_test btree4-$N.8.$i.1 { btree_prev $::c1 } 0 do_test btree4-$N.8.$i.2 { btree_key $::c1 } [format k-%05d $i] do_test btree4-$N.8.$i.3 { btree_data $::c1 } $::data-$i } do_test btree4-$N.9 { btree_prev $::c1 } 1 btree_close_cursor $::c1 } btree_rollback $::b1 btree_pager_ref_dump $::b1 btree_close $::b1 } ;# end if( not mem: and has pager_open command ); finish_test sqlite-2.8.17/test/copy.test0000644000175000001440000001450110232547612015703 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the COPY statement. # # $Id: copy.test,v 1.17 2004/02/17 18:26:57 dougcurrie Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a file of data from which to copy. # set f [open data1.txt w] puts $f "11\t22\t33" puts $f "22\t33\t11" close $f set f [open data2.txt w] puts $f "11\t22\t33" puts $f "\\." puts $f "22\t33\t11" close $f set f [open data3.txt w] puts $f "11\t22\t33\t44" puts $f "22\t33\t11" close $f set f [open data4.txt w] puts $f "11 | 22 | 33" puts $f "22 | 33 | 11" close $f set f [open data5.txt w] puts $f "11|22|33" puts $f "22|33|11" close $f set f [open dataX.txt w] fconfigure $f -translation binary puts -nonewline $f "11|22|33\r" puts -nonewline $f "22|33|44\r\n" puts -nonewline $f "33|44|55\n" puts -nonewline $f "44|55|66\r" puts -nonewline $f "55|66|77\r\n" puts -nonewline $f "66|77|88\n" close $f # Try to COPY into a non-existant table. # do_test copy-1.1 { set v [catch {execsql {COPY test1 FROM 'data1.txt'}} msg] lappend v $msg } {1 {no such table: test1}} # Try to insert into sqlite_master # do_test copy-1.2 { set v [catch {execsql {COPY sqlite_master FROM 'data2.txt'}} msg] lappend v $msg } {1 {table sqlite_master may not be modified}} # Do some actual inserts # do_test copy-1.3 { execsql {CREATE TABLE test1(one int, two int, three int)} execsql {COPY test1 FROM 'data1.txt'} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33 22 33 11} # Make sure input terminates at \. # do_test copy-1.4 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data2.txt'} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33} # Test out the USING DELIMITERS clause # do_test copy-1.5 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data4.txt' USING DELIMITERS ' | '} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33 22 33 11} do_test copy-1.6 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data5.txt' USING DELIMITERS '|'} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33 22 33 11} do_test copy-1.7 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data4.txt' USING DELIMITERS '|'} execsql {SELECT * FROM test1 ORDER BY one} } {{11 } { 22 } { 33} {22 } { 33 } { 11}} # Try copying into a table that has one or more indices. # do_test copy-1.8 { execsql {DELETE FROM test1} execsql {CREATE INDEX index1 ON test1(one)} execsql {CREATE INDEX index2 ON test1(two)} execsql {CREATE INDEX index3 ON test1(three)} execsql {COPY test1 from 'data1.txt'} execsql {SELECT * FROM test1 WHERE one=11} } {11 22 33} do_test copy-1.8b { execsql {SELECT * FROM test1 WHERE one=22} } {22 33 11} do_test copy-1.8c { execsql {SELECT * FROM test1 WHERE two=22} } {11 22 33} do_test copy-1.8d { execsql {SELECT * FROM test1 WHERE three=11} } {22 33 11} # Try inserting really long data # set x {} for {set i 0} {$i<100} {incr i} { append x "($i)-abcdefghijklmnopqrstyvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-" } do_test copy-2.1 { execsql {CREATE TABLE test2(a int, x text)} set f [open data21.txt w] puts $f "123\t$x" close $f execsql {COPY test2 FROM 'data21.txt'} execsql {SELECT x from test2} } $x file delete -force data21.txt # Test the escape character mechanism # do_test copy-3.1 { set fd [open data6.txt w] puts $fd "hello\\\tworld\t1" puts $fd "hello\tworld\\\t2" close $fd execsql { CREATE TABLE t1(a text, b text); COPY t1 FROM 'data6.txt'; SELECT * FROM t1 ORDER BY a; } } {hello {world 2} {hello world} 1} do_test copy-3.2 { set fd [open data6.txt w] puts $fd "1\thello\\\nworld" puts $fd "2\thello world" close $fd execsql { DELETE FROM t1; COPY t1 FROM 'data6.txt'; SELECT * FROM t1 ORDER BY a; } } {1 {hello world} 2 {hello world}} do_test copy-3.3 { set fd [open data6.txt w] puts $fd "1:hello\\b\\f\\n\\r\\t\\vworld" puts $fd "2:hello world" close $fd execsql { DELETE FROM t1; COPY t1 FROM 'data6.txt' USING DELIMITERS ':'; SELECT * FROM t1 ORDER BY a; } } [list 1 "hello\b\f\n\r\t\vworld" 2 "hello world"] # Test the embedded NULL logic. # do_test copy-4.1 { set fd [open data6.txt w] puts $fd "1\t\\N" puts $fd "\\N\thello world" close $fd execsql { DELETE FROM t1; COPY t1 FROM 'data6.txt'; SELECT * FROM t1 WHERE a IS NULL; } } {{} {hello world}} do_test copy-4.2 { execsql { SELECT * FROM t1 WHERE b IS NULL; } } {1 {}} # Test the conflict resolution logic for COPY # do_test copy-5.1 { execsql { DROP TABLE t1; CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE, c); COPY t1 FROM 'data5.txt' USING DELIMITERS '|'; SELECT * FROM t1; } } {11 22 33 22 33 11} do_test copy-5.2 { set fd [open data6.txt w] puts $fd "33|22|44" close $fd catchsql { COPY t1 FROM 'data6.txt' USING DELIMITERS '|'; SELECT * FROM t1; } } {1 {column b is not unique}} do_test copy-5.3 { set fd [open data6.txt w] puts $fd "33|22|44" close $fd catchsql { COPY OR IGNORE t1 FROM 'data6.txt' USING DELIMITERS '|'; SELECT * FROM t1; } } {0 {11 22 33 22 33 11}} do_test copy-5.4 { set fd [open data6.txt w] puts $fd "33|22|44" close $fd catchsql { COPY OR REPLACE t1 FROM 'data6.txt' USING DELIMITERS '|'; SELECT * FROM t1; } } {0 {22 33 11 33 22 44}} do_test copy-5.5 { execsql { DELETE FROM t1; PRAGMA count_changes=on; COPY t1 FROM 'data5.txt' USING DELIMITERS '|'; } } {2} do_test copy-5.6 { execsql { COPY OR REPLACE t1 FROM 'data5.txt' USING DELIMITERS '|'; } } {2} do_test copy-5.7 { execsql { COPY OR IGNORE t1 FROM 'data5.txt' USING DELIMITERS '|'; } } {0} do_test copy-6.1 { execsql { PRAGMA count_changes=off; CREATE TABLE t2(a,b,c); COPY t2 FROM 'dataX.txt' USING DELIMITERS '|'; SELECT * FROM t2; } } {11 22 33 22 33 44 33 44 55 44 55 66 55 66 77 66 77 88} integrity_check copy-7.1 # Cleanup # #file delete -force data1.txt data2.txt data3.txt data4.txt data5.txt \ data6.txt dataX.txt finish_test sqlite-2.8.17/test/conflict.test0000644000175000001440000004737210232547612016546 0ustar drhusers00000000000000# 2002 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the conflict resolution extension # to SQLite. # # $Id: conflict.test,v 1.19 2003/08/05 13:13:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create tables for the first group of tests. # do_test conflict-1.0 { execsql { CREATE TABLE t1(a, b, c, UNIQUE(a,b)); CREATE TABLE t2(x); SELECT c FROM t1 ORDER BY c; } } {} # Six columns of configuration data as follows: # # i The reference number of the test # conf The conflict resolution algorithm on the BEGIN statement # cmd An INSERT or REPLACE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "c" column of t1 assuming no error in $cmd # t2 Content of "x" column of t2 # foreach {i conf cmd t0 t1 t2} { 1 {} INSERT 1 {} 1 2 {} {INSERT OR IGNORE} 0 3 1 3 {} {INSERT OR REPLACE} 0 4 1 4 {} REPLACE 0 4 1 5 {} {INSERT OR FAIL} 1 {} 1 6 {} {INSERT OR ABORT} 1 {} 1 7 {} {INSERT OR ROLLBACK} 1 {} {} 8 IGNORE INSERT 0 3 1 9 IGNORE {INSERT OR IGNORE} 0 3 1 10 IGNORE {INSERT OR REPLACE} 0 4 1 11 IGNORE REPLACE 0 4 1 12 IGNORE {INSERT OR FAIL} 1 {} 1 13 IGNORE {INSERT OR ABORT} 1 {} 1 14 IGNORE {INSERT OR ROLLBACK} 1 {} {} 15 REPLACE INSERT 0 4 1 16 FAIL INSERT 1 {} 1 17 ABORT INSERT 1 {} 1 18 ROLLBACK INSERT 1 {} {} } { do_test conflict-1.$i { if {$conf!=""} {set conf "ON CONFLICT $conf"} set r0 [catch {execsql [subst { DELETE FROM t1; DELETE FROM t2; INSERT INTO t1 VALUES(1,2,3); BEGIN $conf; INSERT INTO t2 VALUES(1); $cmd INTO t1 VALUES(1,2,4); }]} r1] catch {execsql {COMMIT}} if {$r0} {set r1 {}} {set r1 [execsql {SELECT c FROM t1}]} set r2 [execsql {SELECT x FROM t2}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } # Create tables for the first group of tests. # do_test conflict-2.0 { execsql { DROP TABLE t1; DROP TABLE t2; CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, UNIQUE(a,b)); CREATE TABLE t2(x); SELECT c FROM t1 ORDER BY c; } } {} # Six columns of configuration data as follows: # # i The reference number of the test # conf The conflict resolution algorithm on the BEGIN statement # cmd An INSERT or REPLACE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "c" column of t1 assuming no error in $cmd # t2 Content of "x" column of t2 # foreach {i conf cmd t0 t1 t2} { 1 {} INSERT 1 {} 1 2 {} {INSERT OR IGNORE} 0 3 1 3 {} {INSERT OR REPLACE} 0 4 1 4 {} REPLACE 0 4 1 5 {} {INSERT OR FAIL} 1 {} 1 6 {} {INSERT OR ABORT} 1 {} 1 7 {} {INSERT OR ROLLBACK} 1 {} {} 8 IGNORE INSERT 0 3 1 9 IGNORE {INSERT OR IGNORE} 0 3 1 10 IGNORE {INSERT OR REPLACE} 0 4 1 11 IGNORE REPLACE 0 4 1 12 IGNORE {INSERT OR FAIL} 1 {} 1 13 IGNORE {INSERT OR ABORT} 1 {} 1 14 IGNORE {INSERT OR ROLLBACK} 1 {} {} 15 REPLACE INSERT 0 4 1 16 FAIL INSERT 1 {} 1 17 ABORT INSERT 1 {} 1 18 ROLLBACK INSERT 1 {} {} } { do_test conflict-2.$i { if {$conf!=""} {set conf "ON CONFLICT $conf"} set r0 [catch {execsql [subst { DELETE FROM t1; DELETE FROM t2; INSERT INTO t1 VALUES(1,2,3); BEGIN $conf; INSERT INTO t2 VALUES(1); $cmd INTO t1 VALUES(1,2,4); }]} r1] catch {execsql {COMMIT}} if {$r0} {set r1 {}} {set r1 [execsql {SELECT c FROM t1}]} set r2 [execsql {SELECT x FROM t2}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } # Create tables for the first group of tests. # do_test conflict-3.0 { execsql { DROP TABLE t1; DROP TABLE t2; CREATE TABLE t1(a, b, c INTEGER, PRIMARY KEY(c), UNIQUE(a,b)); CREATE TABLE t2(x); SELECT c FROM t1 ORDER BY c; } } {} # Six columns of configuration data as follows: # # i The reference number of the test # conf The conflict resolution algorithm on the BEGIN statement # cmd An INSERT or REPLACE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "c" column of t1 assuming no error in $cmd # t2 Content of "x" column of t2 # foreach {i conf cmd t0 t1 t2} { 1 {} INSERT 1 {} 1 2 {} {INSERT OR IGNORE} 0 3 1 3 {} {INSERT OR REPLACE} 0 4 1 4 {} REPLACE 0 4 1 5 {} {INSERT OR FAIL} 1 {} 1 6 {} {INSERT OR ABORT} 1 {} 1 7 {} {INSERT OR ROLLBACK} 1 {} {} 8 IGNORE INSERT 0 3 1 9 IGNORE {INSERT OR IGNORE} 0 3 1 10 IGNORE {INSERT OR REPLACE} 0 4 1 11 IGNORE REPLACE 0 4 1 12 IGNORE {INSERT OR FAIL} 1 {} 1 13 IGNORE {INSERT OR ABORT} 1 {} 1 14 IGNORE {INSERT OR ROLLBACK} 1 {} {} 15 REPLACE INSERT 0 4 1 16 FAIL INSERT 1 {} 1 17 ABORT INSERT 1 {} 1 18 ROLLBACK INSERT 1 {} {} } { do_test conflict-3.$i { if {$conf!=""} {set conf "ON CONFLICT $conf"} set r0 [catch {execsql [subst { DELETE FROM t1; DELETE FROM t2; INSERT INTO t1 VALUES(1,2,3); BEGIN $conf; INSERT INTO t2 VALUES(1); $cmd INTO t1 VALUES(1,2,4); }]} r1] catch {execsql {COMMIT}} if {$r0} {set r1 {}} {set r1 [execsql {SELECT c FROM t1}]} set r2 [execsql {SELECT x FROM t2}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } do_test conflict-4.0 { execsql { DROP TABLE t2; CREATE TABLE t2(x); SELECT x FROM t2; } } {} # Six columns of configuration data as follows: # # i The reference number of the test # conf1 The conflict resolution algorithm on the UNIQUE constraint # conf2 The conflict resolution algorithm on the BEGIN statement # cmd An INSERT or REPLACE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "c" column of t1 assuming no error in $cmd # t2 Content of "x" column of t2 # foreach {i conf1 conf2 cmd t0 t1 t2} { 1 {} {} INSERT 1 {} 1 2 REPLACE {} INSERT 0 4 1 3 IGNORE {} INSERT 0 3 1 4 FAIL {} INSERT 1 {} 1 5 ABORT {} INSERT 1 {} 1 6 ROLLBACK {} INSERT 1 {} {} 7 REPLACE {} {INSERT OR IGNORE} 0 3 1 8 IGNORE {} {INSERT OR REPLACE} 0 4 1 9 FAIL {} {INSERT OR IGNORE} 0 3 1 10 ABORT {} {INSERT OR REPLACE} 0 4 1 11 ROLLBACK {} {INSERT OR IGNORE } 0 3 1 12 REPLACE IGNORE INSERT 0 3 1 13 IGNORE REPLACE INSERT 0 4 1 14 FAIL IGNORE INSERT 0 3 1 15 ABORT REPLACE INSERT 0 4 1 16 ROLLBACK IGNORE INSERT 0 3 1 12 IGNORE REPLACE INSERT 0 4 1 13 IGNORE FAIL INSERT 1 {} 1 14 IGNORE ABORT INSERT 1 {} 1 15 IGNORE ROLLBACK INSERT 1 {} {} } { do_test conflict-4.$i { if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"} if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"} set r0 [catch {execsql [subst { DROP TABLE t1; CREATE TABLE t1(a,b,c,UNIQUE(a,b) $conf1); DELETE FROM t2; INSERT INTO t1 VALUES(1,2,3); BEGIN $conf2; INSERT INTO t2 VALUES(1); $cmd INTO t1 VALUES(1,2,4); }]} r1] catch {execsql {COMMIT}} if {$r0} {set r1 {}} {set r1 [execsql {SELECT c FROM t1}]} set r2 [execsql {SELECT x FROM t2}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } do_test conflict-5.0 { execsql { DROP TABLE t2; CREATE TABLE t2(x); SELECT x FROM t2; } } {} # Six columns of configuration data as follows: # # i The reference number of the test # conf1 The conflict resolution algorithm on the NOT NULL constraint # conf2 The conflict resolution algorithm on the BEGIN statement # cmd An INSERT or REPLACE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "c" column of t1 assuming no error in $cmd # t2 Content of "x" column of t2 # foreach {i conf1 conf2 cmd t0 t1 t2} { 1 {} {} INSERT 1 {} 1 2 REPLACE {} INSERT 0 5 1 3 IGNORE {} INSERT 0 {} 1 4 FAIL {} INSERT 1 {} 1 5 ABORT {} INSERT 1 {} 1 6 ROLLBACK {} INSERT 1 {} {} 7 REPLACE {} {INSERT OR IGNORE} 0 {} 1 8 IGNORE {} {INSERT OR REPLACE} 0 5 1 9 FAIL {} {INSERT OR IGNORE} 0 {} 1 10 ABORT {} {INSERT OR REPLACE} 0 5 1 11 ROLLBACK {} {INSERT OR IGNORE} 0 {} 1 12 {} {} {INSERT OR IGNORE} 0 {} 1 13 {} {} {INSERT OR REPLACE} 0 5 1 14 {} {} {INSERT OR FAIL} 1 {} 1 15 {} {} {INSERT OR ABORT} 1 {} 1 16 {} {} {INSERT OR ROLLBACK} 1 {} {} 17 {} IGNORE INSERT 0 {} 1 18 {} REPLACE INSERT 0 5 1 19 {} FAIL INSERT 1 {} 1 20 {} ABORT INSERT 1 {} 1 21 {} ROLLBACK INSERT 1 {} {} 22 REPLACE FAIL INSERT 1 {} 1 23 IGNORE ROLLBACK INSERT 1 {} {} } { if {$t0} {set t1 {t1.c may not be NULL}} do_test conflict-5.$i { if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"} if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"} set r0 [catch {execsql [subst { DROP TABLE t1; CREATE TABLE t1(a,b,c NOT NULL $conf1 DEFAULT 5); DELETE FROM t2; BEGIN $conf2; INSERT INTO t2 VALUES(1); $cmd INTO t1 VALUES(1,2,NULL); }]} r1] catch {execsql {COMMIT}} if {!$r0} {set r1 [execsql {SELECT c FROM t1}]} set r2 [execsql {SELECT x FROM t2}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } do_test conflict-6.0 { execsql { DROP TABLE t2; CREATE TABLE t2(a,b,c); INSERT INTO t2 VALUES(1,2,1); INSERT INTO t2 VALUES(2,3,2); INSERT INTO t2 VALUES(3,4,1); INSERT INTO t2 VALUES(4,5,4); SELECT c FROM t2 ORDER BY b; CREATE TABLE t3(x); INSERT INTO t3 VALUES(1); } } {1 2 1 4} # Six columns of configuration data as follows: # # i The reference number of the test # conf1 The conflict resolution algorithm on the UNIQUE constraint # conf2 The conflict resolution algorithm on the BEGIN statement # cmd An UPDATE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "b" column of t1 assuming no error in $cmd # t2 Content of "x" column of t3 # foreach {i conf1 conf2 cmd t0 t1 t2} { 1 {} {} UPDATE 1 {6 7 8 9} 1 2 REPLACE {} UPDATE 0 {7 6 9} 1 3 IGNORE {} UPDATE 0 {6 7 3 9} 1 4 FAIL {} UPDATE 1 {6 7 3 4} 1 5 ABORT {} UPDATE 1 {1 2 3 4} 1 6 ROLLBACK {} UPDATE 1 {1 2 3 4} 0 7 REPLACE {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 8 IGNORE {} {UPDATE OR REPLACE} 0 {7 6 9} 1 9 FAIL {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 10 ABORT {} {UPDATE OR REPLACE} 0 {7 6 9} 1 11 ROLLBACK {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 12 {} {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 13 {} {} {UPDATE OR REPLACE} 0 {7 6 9} 1 14 {} {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 15 {} {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 16 {} {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 17 {} IGNORE UPDATE 0 {6 7 3 9} 1 18 {} REPLACE UPDATE 0 {7 6 9} 1 19 {} FAIL UPDATE 1 {6 7 3 4} 1 20 {} ABORT UPDATE 1 {1 2 3 4} 1 21 {} ROLLBACK UPDATE 1 {1 2 3 4} 0 22 REPLACE IGNORE UPDATE 0 {6 7 3 9} 1 23 IGNORE REPLACE UPDATE 0 {7 6 9} 1 24 REPLACE FAIL UPDATE 1 {6 7 3 4} 1 25 IGNORE ABORT UPDATE 1 {1 2 3 4} 1 26 REPLACE ROLLBACK UPDATE 1 {1 2 3 4} 0 } { if {$t0} {set t1 {column a is not unique}} do_test conflict-6.$i { if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"} if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"} set r0 [catch {execsql [subst { DROP TABLE t1; CREATE TABLE t1(a,b,c, UNIQUE(a) $conf1); INSERT INTO t1 SELECT * FROM t2; UPDATE t3 SET x=0; BEGIN $conf2; $cmd t3 SET x=1; $cmd t1 SET b=b*2; $cmd t1 SET a=c+5; }]} r1] catch {execsql {COMMIT}} if {!$r0} {set r1 [execsql {SELECT a FROM t1 ORDER BY b}]} set r2 [execsql {SELECT x FROM t3}] list $r0 $r1 $r2 } [list $t0 $t1 $t2] } # Test to make sure a lot of IGNOREs don't cause a stack overflow # do_test conflict-7.1 { execsql { DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; CREATE TABLE t1(a unique, b); } for {set i 1} {$i<=50} {incr i} { execsql "INSERT into t1 values($i,[expr {$i+1}]);" } execsql { SELECT count(*), min(a), max(b) FROM t1; } } {50 1 51} do_test conflict-7.2 { execsql { PRAGMA count_changes=on; UPDATE OR IGNORE t1 SET a=1000; } } {1} do_test conflict-7.2.1 { db changes } {1} do_test conflict-7.3 { execsql { SELECT b FROM t1 WHERE a=1000; } } {2} do_test conflict-7.4 { execsql { SELECT count(*) FROM t1; } } {50} do_test conflict-7.5 { execsql { PRAGMA count_changes=on; UPDATE OR REPLACE t1 SET a=1001; } } {50} do_test conflict-7.5.1 { db changes } {50} do_test conflict-7.6 { execsql { SELECT b FROM t1 WHERE a=1001; } } {51} do_test conflict-7.7 { execsql { SELECT count(*) FROM t1; } } {1} do_test conflict-7.7.1 { db changes } {0} # Make sure the row count is right for rows that are ignored on # an insert. # do_test conflict-8.1 { execsql { DELETE FROM t1; INSERT INTO t1 VALUES(1,2); } execsql { INSERT OR IGNORE INTO t1 VALUES(2,3); } } {1} do_test conflict-8.1.1 { db changes } {1} do_test conflict-8.2 { execsql { INSERT OR IGNORE INTO t1 VALUES(2,4); } } {0} do_test conflict-8.2.1 { db changes } {0} do_test conflict-8.3 { execsql { INSERT OR REPLACE INTO t1 VALUES(2,4); } } {1} do_test conflict-8.3.1 { db changes } {1} do_test conflict-8.4 { execsql { INSERT OR IGNORE INTO t1 SELECT * FROM t1; } } {0} do_test conflict-8.4.1 { db changes } {0} do_test conflict-8.5 { execsql { INSERT OR IGNORE INTO t1 SELECT a+2,b+2 FROM t1; } } {2} do_test conflict-8.5.1 { db changes } {2} do_test conflict-8.6 { execsql { INSERT OR IGNORE INTO t1 SELECT a+3,b+3 FROM t1; } } {3} do_test conflict-8.6.1 { db changes } {3} integrity_check conflict-8.99 do_test conflict-9.1 { execsql { PRAGMA count_changes=0; CREATE TABLE t2( a INTEGER UNIQUE ON CONFLICT IGNORE, b INTEGER UNIQUE ON CONFLICT FAIL, c INTEGER UNIQUE ON CONFLICT REPLACE, d INTEGER UNIQUE ON CONFLICT ABORT, e INTEGER UNIQUE ON CONFLICT ROLLBACK ); CREATE TABLE t3(x); INSERT INTO t3 VALUES(1); SELECT * FROM t3; } } {1} do_test conflict-9.2 { catchsql { INSERT INTO t2 VALUES(1,1,1,1,1); INSERT INTO t2 VALUES(2,2,2,2,2); SELECT * FROM t2; } } {0 {1 1 1 1 1 2 2 2 2 2}} do_test conflict-9.3 { catchsql { INSERT INTO t2 VALUES(1,3,3,3,3); SELECT * FROM t2; } } {0 {1 1 1 1 1 2 2 2 2 2}} do_test conflict-9.4 { catchsql { UPDATE t2 SET a=a+1 WHERE a=1; SELECT * FROM t2; } } {0 {1 1 1 1 1 2 2 2 2 2}} do_test conflict-9.5 { catchsql { INSERT INTO t2 VALUES(3,1,3,3,3); SELECT * FROM t2; } } {1 {column b is not unique}} do_test conflict-9.6 { catchsql { UPDATE t2 SET b=b+1 WHERE b=1; SELECT * FROM t2; } } {1 {column b is not unique}} do_test conflict-9.7 { catchsql { BEGIN; UPDATE t3 SET x=x+1; INSERT INTO t2 VALUES(3,1,3,3,3); SELECT * FROM t2; } } {1 {column b is not unique}} do_test conflict-9.8 { execsql {COMMIT} execsql {SELECT * FROM t3} } {2} do_test conflict-9.9 { catchsql { BEGIN; UPDATE t3 SET x=x+1; UPDATE t2 SET b=b+1 WHERE b=1; SELECT * FROM t2; } } {1 {column b is not unique}} do_test conflict-9.10 { execsql {COMMIT} execsql {SELECT * FROM t3} } {3} do_test conflict-9.11 { catchsql { INSERT INTO t2 VALUES(3,3,3,1,3); SELECT * FROM t2; } } {1 {column d is not unique}} do_test conflict-9.12 { catchsql { UPDATE t2 SET d=d+1 WHERE d=1; SELECT * FROM t2; } } {1 {column d is not unique}} do_test conflict-9.13 { catchsql { BEGIN; UPDATE t3 SET x=x+1; INSERT INTO t2 VALUES(3,3,3,1,3); SELECT * FROM t2; } } {1 {column d is not unique}} do_test conflict-9.14 { execsql {COMMIT} execsql {SELECT * FROM t3} } {4} do_test conflict-9.15 { catchsql { BEGIN; UPDATE t3 SET x=x+1; UPDATE t2 SET d=d+1 WHERE d=1; SELECT * FROM t2; } } {1 {column d is not unique}} do_test conflict-9.16 { execsql {COMMIT} execsql {SELECT * FROM t3} } {5} do_test conflict-9.17 { catchsql { INSERT INTO t2 VALUES(3,3,3,3,1); SELECT * FROM t2; } } {1 {column e is not unique}} do_test conflict-9.18 { catchsql { UPDATE t2 SET e=e+1 WHERE e=1; SELECT * FROM t2; } } {1 {column e is not unique}} do_test conflict-9.19 { catchsql { BEGIN; UPDATE t3 SET x=x+1; INSERT INTO t2 VALUES(3,3,3,3,1); SELECT * FROM t2; } } {1 {column e is not unique}} do_test conflict-9.20 { catch {execsql {COMMIT}} execsql {SELECT * FROM t3} } {5} do_test conflict-9.21 { catchsql { BEGIN; UPDATE t3 SET x=x+1; UPDATE t2 SET e=e+1 WHERE e=1; SELECT * FROM t2; } } {1 {column e is not unique}} do_test conflict-9.22 { catch {execsql {COMMIT}} execsql {SELECT * FROM t3} } {5} do_test conflict-9.23 { catchsql { INSERT INTO t2 VALUES(3,3,1,3,3); SELECT * FROM t2; } } {0 {2 2 2 2 2 3 3 1 3 3}} do_test conflict-9.24 { catchsql { UPDATE t2 SET c=c-1 WHERE c=2; SELECT * FROM t2; } } {0 {2 2 1 2 2}} do_test conflict-9.25 { catchsql { BEGIN; UPDATE t3 SET x=x+1; INSERT INTO t2 VALUES(3,3,1,3,3); SELECT * FROM t2; } } {0 {3 3 1 3 3}} do_test conflict-9.26 { catch {execsql {COMMIT}} execsql {SELECT * FROM t3} } {6} do_test conflict-10.1 { catchsql { DELETE FROM t1; BEGIN ON CONFLICT ROLLBACK; INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(1,3); COMMIT; } execsql {SELECT * FROM t1} } {} do_test conflict-10.2 { catchsql { CREATE TABLE t4(x); CREATE UNIQUE INDEX t4x ON t4(x); BEGIN ON CONFLICT ROLLBACK; INSERT INTO t4 VALUES(1); INSERT INTO t4 VALUES(1); COMMIT; } execsql {SELECT * FROM t4} } {} integrity_check conflict-99.0 finish_test sqlite-2.8.17/test/minmax.test0000644000175000001440000001736310232547612016233 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that contain # aggregate min() and max() functions and which are handled as # as a special case. # # $Id: minmax.test,v 1.9.2.2 2004/07/18 21:14:05 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test minmax-1.0 { execsql { BEGIN; CREATE TABLE t1(x, y); INSERT INTO t1 VALUES(1,1); INSERT INTO t1 VALUES(2,2); INSERT INTO t1 VALUES(3,2); INSERT INTO t1 VALUES(4,3); INSERT INTO t1 VALUES(5,3); INSERT INTO t1 VALUES(6,3); INSERT INTO t1 VALUES(7,3); INSERT INTO t1 VALUES(8,4); INSERT INTO t1 VALUES(9,4); INSERT INTO t1 VALUES(10,4); INSERT INTO t1 VALUES(11,4); INSERT INTO t1 VALUES(12,4); INSERT INTO t1 VALUES(13,4); INSERT INTO t1 VALUES(14,4); INSERT INTO t1 VALUES(15,4); INSERT INTO t1 VALUES(16,5); INSERT INTO t1 VALUES(17,5); INSERT INTO t1 VALUES(18,5); INSERT INTO t1 VALUES(19,5); INSERT INTO t1 VALUES(20,5); COMMIT; SELECT DISTINCT y FROM t1 ORDER BY y; } } {1 2 3 4 5} do_test minmax-1.1 { set sqlite_search_count 0 execsql {SELECT min(x) FROM t1} } {1} do_test minmax-1.2 { set sqlite_search_count } {19} do_test minmax-1.3 { set sqlite_search_count 0 execsql {SELECT max(x) FROM t1} } {20} do_test minmax-1.4 { set sqlite_search_count } {19} do_test minmax-1.5 { execsql {CREATE INDEX t1i1 ON t1(x)} set sqlite_search_count 0 execsql {SELECT min(x) FROM t1} } {1} do_test minmax-1.6 { set sqlite_search_count } {2} do_test minmax-1.7 { set sqlite_search_count 0 execsql {SELECT max(x) FROM t1} } {20} do_test minmax-1.8 { set sqlite_search_count } {1} do_test minmax-1.9 { set sqlite_search_count 0 execsql {SELECT max(y) FROM t1} } {5} do_test minmax-1.10 { set sqlite_search_count } {19} do_test minmax-2.0 { execsql { CREATE TABLE t2(a INTEGER PRIMARY KEY, b); INSERT INTO t2 SELECT * FROM t1; } set sqlite_search_count 0 execsql {SELECT min(a) FROM t2} } {1} do_test minmax-2.1 { set sqlite_search_count } {0} do_test minmax-2.2 { set sqlite_search_count 0 execsql {SELECT max(a) FROM t2} } {20} do_test minmax-2.3 { set sqlite_search_count } {0} do_test minmax-3.0 { execsql {INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)} set sqlite_search_count 0 execsql {SELECT max(a) FROM t2} } {21} do_test minmax-3.1 { set sqlite_search_count } {0} do_test minmax-3.2 { execsql {INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)} set sqlite_search_count 0 execsql { SELECT b FROM t2 WHERE a=(SELECT max(a) FROM t2) } } {999} do_test minmax-3.3 { set sqlite_search_count } {0} do_test minmax-4.1 { execsql { SELECT coalesce(min(x+0),-1), coalesce(max(x+0),-1) FROM (SELECT * FROM t1 UNION SELECT NULL as 'x', NULL as 'y') } } {1 20} do_test minmax-4.2 { execsql { SELECT y, sum(x) FROM (SELECT null, y+1 FROM t1 UNION SELECT * FROM t1) GROUP BY y ORDER BY y; } } {1 1 2 5 3 22 4 92 5 90 6 0} do_test minmax-4.3 { execsql { SELECT y, count(x), count(*) FROM (SELECT null, y+1 FROM t1 UNION SELECT * FROM t1) GROUP BY y ORDER BY y; } } {1 1 1 2 2 3 3 4 5 4 8 9 5 5 6 6 0 1} # Make sure the min(x) and max(x) optimizations work on empty tables # including empty tables with indices. Ticket #296. # do_test minmax-5.1 { execsql { CREATE TABLE t3(x INTEGER UNIQUE NOT NULL); SELECT coalesce(min(x),999) FROM t3; } } {999} do_test minmax-5.2 { execsql { SELECT coalesce(min(rowid),999) FROM t3; } } {999} do_test minmax-5.3 { execsql { SELECT coalesce(max(x),999) FROM t3; } } {999} do_test minmax-5.4 { execsql { SELECT coalesce(max(rowid),999) FROM t3; } } {999} do_test minmax-5.5 { execsql { SELECT coalesce(max(rowid),999) FROM t3 WHERE rowid<25; } } {999} # Make sure the min(x) and max(x) optimizations work when there # is a LIMIT clause. Ticket #396. # do_test minmax-6.1 { execsql { SELECT min(a) FROM t2 LIMIT 1 } } {1} do_test minmax-6.2 { execsql { SELECT max(a) FROM t2 LIMIT 3 } } {22} do_test minmax-6.3 { execsql { SELECT min(a) FROM t2 LIMIT 0,100 } } {1} do_test minmax-6.4 { execsql { SELECT max(a) FROM t2 LIMIT 1,100 } } {} do_test minmax-6.5 { execsql { SELECT min(x) FROM t3 LIMIT 1 } } {{}} do_test minmax-6.6 { execsql { SELECT max(x) FROM t3 LIMIT 0 } } {} do_test minmax-6.7 { execsql { SELECT max(a) FROM t2 LIMIT 0 } } {} # Make sure the max(x) and min(x) optimizations work for nested # queries. Ticket #587. # do_test minmax-7.1 { execsql { SELECT max(x) FROM t1; } } 20 do_test minmax-7.2 { execsql { SELECT * FROM (SELECT max(x) FROM t1); } } 20 do_test minmax-7.3 { execsql { SELECT min(x) FROM t1; } } 1 do_test minmax-7.4 { execsql { SELECT * FROM (SELECT min(x) FROM t1); } } 1 # Make sure min(x) and max(x) work correctly when the datatype is # TEXT instead of NUMERIC. Ticket #623. # do_test minmax-8.1 { execsql { CREATE TABLE t4(a TEXT); INSERT INTO t4 VALUES('1234'); INSERT INTO t4 VALUES('234'); INSERT INTO t4 VALUES('34'); SELECT min(a), max(a) FROM t4; } } {1234 34} do_test minmax-8.2 { execsql { CREATE TABLE t5(a INTEGER); INSERT INTO t5 VALUES('1234'); INSERT INTO t5 VALUES('234'); INSERT INTO t5 VALUES('34'); SELECT min(a), max(a) FROM t5; } } {34 1234} # Ticket #658: Test the min()/max() optimization when the FROM clause # is a subquery. # do_test minmax-9.1 { execsql { SELECT max(rowid) FROM ( SELECT max(rowid) FROM t4 UNION SELECT max(rowid) FROM t5 ) } } {1} do_test minmax-9.2 { execsql { SELECT max(rowid) FROM ( SELECT max(rowid) FROM t4 EXCEPT SELECT max(rowid) FROM t5 ) } } {{}} # If there is a NULL in an aggregate max() or min(), ignore it. An # aggregate min() or max() will only return NULL if all values are NULL. # do_test minmax-10.1 { execsql { CREATE TABLE t6(x); INSERT INTO t6 VALUES(1); INSERT INTO t6 VALUES(2); INSERT INTO t6 VALUES(NULL); SELECT coalesce(min(x),-1) FROM t6; } } {1} do_test minmax-10.2 { execsql { SELECT max(x) FROM t6; } } {2} do_test minmax-10.3 { execsql { CREATE INDEX i6 ON t6(x); SELECT coalesce(min(x),-1) FROM t6; } } {1} do_test minmax-10.4 { execsql { SELECT max(x) FROM t6; } } {2} do_test minmax-10.5 { execsql { DELETE FROM t6 WHERE x NOT NULL; SELECT count(*) FROM t6; } } 1 do_test minmax-10.6 { execsql { SELECT count(x) FROM t6; } } 0 do_test minmax-10.7 { execsql { SELECT (SELECT min(x) FROM t6), (SELECT max(x) FROM t6); } } {{} {}} do_test minmax-10.8 { execsql { SELECT min(x), max(x) FROM t6; } } {{} {}} do_test minmax-10.9 { execsql { INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; SELECT count(*) FROM t6; } } 1024 do_test minmax-10.10 { execsql { SELECT count(x) FROM t6; } } 0 do_test minmax-10.11 { execsql { SELECT (SELECT min(x) FROM t6), (SELECT max(x) FROM t6); } } {{} {}} do_test minmax-10.12 { execsql { SELECT min(x), max(x) FROM t6; } } {{} {}} finish_test sqlite-2.8.17/test/bigrow.test0000644000175000001440000001241710232547612016226 0ustar drhusers00000000000000# 2001 September 23 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is stressing the library by putting large amounts # of data in a single row of a table. # # $Id: bigrow.test,v 1.4 2001/11/24 00:31:47 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Make a big string that we can use for test data # do_test bigrow-1.0 { set ::bigstr {} for {set i 1} {$i<=9999} {incr i} { set sep [string index "abcdefghijklmnopqrstuvwxyz" [expr {$i%26}]] append ::bigstr "$sep [format %04d $i] " } string length $::bigstr } {69993} # Make a table into which we can insert some but records. # do_test bigrow-1.1 { execsql { CREATE TABLE t1(a text, b text, c text); SELECT name FROM sqlite_master WHERE type='table' OR type='index' ORDER BY name } } {t1} do_test bigrow-1.2 { set ::big1 [string range $::bigstr 0 65519] set sql "INSERT INTO t1 VALUES('abc'," append sql "'$::big1', 'xyz');" execsql $sql execsql {SELECT a, c FROM t1} } {abc xyz} do_test bigrow-1.3 { execsql {SELECT b FROM t1} } [list $::big1] do_test bigrow-1.4 { set ::big2 [string range $::bigstr 0 65520] set sql "INSERT INTO t1 VALUES('abc2'," append sql "'$::big2', 'xyz2');" set r [catch {execsql $sql} msg] lappend r $msg } {0 {}} do_test bigrow-1.4.1 { execsql {SELECT b FROM t1 ORDER BY c} } [list $::big1 $::big2] do_test bigrow-1.4.2 { execsql {SELECT c FROM t1 ORDER BY c} } {xyz xyz2} do_test bigrow-1.4.3 { execsql {DELETE FROM t1 WHERE a='abc2'} execsql {SELECT c FROM t1} } {xyz} do_test bigrow-1.5 { execsql { UPDATE t1 SET a=b, b=a; SELECT b,c FROM t1 } } {abc xyz} do_test bigrow-1.6 { execsql { SELECT * FROM t1 } } [list $::big1 abc xyz] do_test bigrow-1.7 { execsql { INSERT INTO t1 VALUES('1','2','3'); INSERT INTO t1 VALUES('A','B','C'); SELECT b FROM t1 WHERE a=='1'; } } {2} do_test bigrow-1.8 { execsql "SELECT b FROM t1 WHERE a=='$::big1'" } {abc} do_test bigrow-1.9 { execsql "SELECT b FROM t1 WHERE a!='$::big1' ORDER BY a" } {2 B} # Try doing some indexing on big columns # do_test bigrow-2.1 { execsql { CREATE INDEX i1 ON t1(a) } execsql "SELECT b FROM t1 WHERE a=='$::big1'" } {abc} do_test bigrow-2.2 { execsql { UPDATE t1 SET a=b, b=a } execsql "SELECT b FROM t1 WHERE a=='abc'" } [list $::big1] do_test bigrow-2.3 { execsql { UPDATE t1 SET a=b, b=a } execsql "SELECT b FROM t1 WHERE a=='$::big1'" } {abc} catch {unset ::bigstr} catch {unset ::big1} catch {unset ::big2} # Mosts of the tests above were created back when rows were limited in # size to 64K. Now rows can be much bigger. Test that logic. Also # make sure things work correctly at the transition boundries between # row sizes of 256 to 257 bytes and from 65536 to 65537 bytes. # # We begin by testing the 256..257 transition. # do_test bigrow-3.1 { execsql { DELETE FROM t1; INSERT INTO t1(a,b,c) VALUES('one','abcdefghijklmnopqrstuvwxyz0123','hi'); } execsql {SELECT a,length(b),c FROM t1} } {one 30 hi} do_test bigrow-3.2 { execsql { UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; } execsql {SELECT a,length(b),c FROM t1} } {one 240 hi} for {set i 1} {$i<10} {incr i} { do_test bigrow-3.3.$i { execsql "UPDATE t1 SET b=b||'$i'" execsql {SELECT a,length(b),c FROM t1} } "one [expr {240+$i}] hi" } # Now test the 65536..65537 row-size transition. # do_test bigrow-4.1 { execsql { DELETE FROM t1; INSERT INTO t1(a,b,c) VALUES('one','abcdefghijklmnopqrstuvwxyz0123','hi'); } execsql {SELECT a,length(b),c FROM t1} } {one 30 hi} do_test bigrow-4.2 { execsql { UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; UPDATE t1 SET b=b||b; } execsql {SELECT a,length(b),c FROM t1} } {one 122880 hi} do_test bigrow-4.3 { execsql { UPDATE t1 SET b=substr(b,1,65515) } execsql {SELECT a,length(b),c FROM t1} } {one 65515 hi} for {set i 1} {$i<10} {incr i} { do_test bigrow-4.4.$i { execsql "UPDATE t1 SET b=b||'$i'" execsql {SELECT a,length(b),c FROM t1} } "one [expr {65515+$i}] hi" } # Check to make sure the library recovers safely if a row contains # too much data. # do_test bigrow-5.1 { execsql { DELETE FROM t1; INSERT INTO t1(a,b,c) VALUES('one','abcdefghijklmnopqrstuvwxyz0123','hi'); } execsql {SELECT a,length(b),c FROM t1} } {one 30 hi} set i 1 for {set sz 60} {$sz<1048560} {incr sz $sz} { do_test bigrow-5.2.$i { execsql { UPDATE t1 SET b=b||b; SELECT a,length(b),c FROM t1; } } "one $sz hi" incr i } do_test bigrow-5.3 { set r [catch {execsql {UPDATE t1 SET b=b||b}} msg] lappend r $msg } {1 {too much data for one table row}} do_test bigrow-5.4 { execsql {DROP TABLE t1} } {} finish_test sqlite-2.8.17/test/threadtest1.c0000644000175000001440000001672310232547612016434 0ustar drhusers00000000000000/* ** 2002 January 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file implements a simple standalone program used to test whether ** or not the SQLite library is threadsafe. ** ** Testing the thread safety of SQLite is difficult because there are very ** few places in the code that are even potentially unsafe, and those ** places execute for very short periods of time. So even if the library ** is compiled with its mutexes disabled, it is likely to work correctly ** in a multi-threaded program most of the time. ** ** This file is NOT part of the standard SQLite library. It is used for ** testing only. */ #include "sqlite.h" #include #include #include #include #include #include /* ** Enable for tracing */ static int verbose = 0; /* ** Come here to die. */ static void Exit(int rc){ exit(rc); } extern char *sqlite_mprintf(const char *zFormat, ...); extern char *sqlite_vmprintf(const char *zFormat, va_list); /* ** When a lock occurs, yield. */ static int db_is_locked(void *NotUsed, const char *zNotUsed, int iNotUsed){ /* sched_yield(); */ if( verbose ) printf("BUSY %s\n", (char*)NotUsed); usleep(100); return 1; } /* ** Used to accumulate query results by db_query() */ struct QueryResult { const char *zFile; /* Filename - used for error reporting */ int nElem; /* Number of used entries in azElem[] */ int nAlloc; /* Number of slots allocated for azElem[] */ char **azElem; /* The result of the query */ }; /* ** The callback function for db_query */ static int db_query_callback( void *pUser, /* Pointer to the QueryResult structure */ int nArg, /* Number of columns in this result row */ char **azArg, /* Text of data in all columns */ char **NotUsed /* Names of the columns */ ){ struct QueryResult *pResult = (struct QueryResult*)pUser; int i; if( pResult->nElem + nArg >= pResult->nAlloc ){ if( pResult->nAlloc==0 ){ pResult->nAlloc = nArg+1; }else{ pResult->nAlloc = pResult->nAlloc*2 + nArg + 1; } pResult->azElem = realloc( pResult->azElem, pResult->nAlloc*sizeof(char*)); if( pResult->azElem==0 ){ fprintf(stdout,"%s: malloc failed\n", pResult->zFile); return 1; } } if( azArg==0 ) return 0; for(i=0; iazElem[pResult->nElem++] = sqlite_mprintf("%s",azArg[i] ? azArg[i] : ""); } return 0; } /* ** Execute a query against the database. NULL values are returned ** as an empty string. The list is terminated by a single NULL pointer. */ char **db_query(sqlite *db, const char *zFile, const char *zFormat, ...){ char *zSql; int rc; char *zErrMsg = 0; va_list ap; struct QueryResult sResult; va_start(ap, zFormat); zSql = sqlite_vmprintf(zFormat, ap); va_end(ap); memset(&sResult, 0, sizeof(sResult)); sResult.zFile = zFile; if( verbose ) printf("QUERY %s: %s\n", zFile, zSql); rc = sqlite_exec(db, zSql, db_query_callback, &sResult, &zErrMsg); if( rc==SQLITE_SCHEMA ){ if( zErrMsg ) free(zErrMsg); rc = sqlite_exec(db, zSql, db_query_callback, &sResult, &zErrMsg); } if( verbose ) printf("DONE %s %s\n", zFile, zSql); if( zErrMsg ){ fprintf(stdout,"%s: query failed: %s - %s\n", zFile, zSql, zErrMsg); free(zErrMsg); free(zSql); Exit(1); } sqlite_freemem(zSql); if( sResult.azElem==0 ){ db_query_callback(&sResult, 0, 0, 0); } sResult.azElem[sResult.nElem] = 0; return sResult.azElem; } /* ** Execute an SQL statement. */ void db_execute(sqlite *db, const char *zFile, const char *zFormat, ...){ char *zSql; int rc; char *zErrMsg = 0; va_list ap; va_start(ap, zFormat); zSql = sqlite_vmprintf(zFormat, ap); va_end(ap); if( verbose ) printf("EXEC %s: %s\n", zFile, zSql); rc = sqlite_exec(db, zSql, 0, 0, &zErrMsg); while( rc==SQLITE_SCHEMA ){ if( zErrMsg ) free(zErrMsg); rc = sqlite_exec(db, zSql, 0, 0, &zErrMsg); } if( verbose ) printf("DONE %s: %s\n", zFile, zSql); if( zErrMsg ){ fprintf(stdout,"%s: command failed: %s - %s\n", zFile, zSql, zErrMsg); free(zErrMsg); sqlite_freemem(zSql); Exit(1); } sqlite_freemem(zSql); } /* ** Free the results of a db_query() call. */ void db_query_free(char **az){ int i; for(i=0; az[i]; i++){ sqlite_freemem(az[i]); } free(az); } /* ** Check results */ void db_check(const char *zFile, const char *zMsg, char **az, ...){ va_list ap; int i; char *z; va_start(ap, az); for(i=0; (z = va_arg(ap, char*))!=0; i++){ if( az[i]==0 || strcmp(az[i],z)!=0 ){ fprintf(stdout,"%s: %s: bad result in column %d: %s\n", zFile, zMsg, i+1, az[i]); db_query_free(az); Exit(1); } } va_end(ap); db_query_free(az); } pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t sig = PTHREAD_COND_INITIALIZER; int thread_cnt = 0; static void *worker_bee(void *pArg){ const char *zFilename = (char*)pArg; char *azErr; int i, cnt; int t = atoi(zFilename); char **az; sqlite *db; pthread_mutex_lock(&lock); thread_cnt++; pthread_mutex_unlock(&lock); printf("%s: START\n", zFilename); fflush(stdout); for(cnt=0; cnt<10; cnt++){ db = sqlite_open(&zFilename[2], 0, &azErr); if( db==0 ){ fprintf(stdout,"%s: can't open\n", zFilename); Exit(1); } sqlite_busy_handler(db, db_is_locked, zFilename); db_execute(db, zFilename, "CREATE TABLE t%d(a,b,c);", t); for(i=1; i<=100; i++){ db_execute(db, zFilename, "INSERT INTO t%d VALUES(%d,%d,%d);", t, i, i*2, i*i); } az = db_query(db, zFilename, "SELECT count(*) FROM t%d", t); db_check(zFilename, "tX size", az, "100", 0); az = db_query(db, zFilename, "SELECT avg(b) FROM t%d", t); db_check(zFilename, "tX avg", az, "101", 0); db_execute(db, zFilename, "DELETE FROM t%d WHERE a>50", t); az = db_query(db, zFilename, "SELECT avg(b) FROM t%d", t); db_check(zFilename, "tX avg2", az, "51", 0); for(i=1; i<=50; i++){ char z1[30], z2[30]; az = db_query(db, zFilename, "SELECT b, c FROM t%d WHERE a=%d", t, i); sprintf(z1, "%d", i*2); sprintf(z2, "%d", i*i); db_check(zFilename, "readback", az, z1, z2, 0); } db_execute(db, zFilename, "DROP TABLE t%d;", t); sqlite_close(db); } printf("%s: END\n", zFilename); /* unlink(zFilename); */ fflush(stdout); pthread_mutex_lock(&lock); thread_cnt--; if( thread_cnt<=0 ){ pthread_cond_signal(&sig); } pthread_mutex_unlock(&lock); return 0; } int main(int argc, char **argv){ char *zFile; int i, n; pthread_t id; if( argc>2 && strcmp(argv[1], "-v")==0 ){ verbose = 1; argc--; argv++; } if( argc<2 || (n=atoi(argv[1]))<1 ) n = 10; for(i=0; i0 ){ pthread_cond_wait(&sig, &lock); } pthread_mutex_unlock(&lock); for(i=0; i #include #include #include #include #include "sqlite.h" /* ** Name of the database */ #define DB_FILE "test.db" /* ** When this variable becomes non-zero, all threads stop ** what they are doing. */ volatile int all_stop = 0; /* ** Callback from the integrity check. If the result is anything other ** than "ok" it means the integrity check has failed. Set the "all_stop" ** global variable to stop all other activity. Print the error message ** or print OK if the string "ok" is seen. */ int check_callback(void *notUsed, int argc, char **argv, char **notUsed2){ if( strcmp(argv[0],"ok") ){ all_stop = 1; fprintf(stderr,"pid=%d. %s\n", getpid(), argv[0]); }else{ /* fprintf(stderr,"pid=%d. OK\n", getpid()); */ } return 0; } /* ** Do an integrity check on the database. If the first integrity check ** fails, try it a second time. */ int integrity_check(sqlite *db){ int rc; if( all_stop ) return 0; /* fprintf(stderr,"pid=%d: CHECK\n", getpid()); */ rc = sqlite_exec(db, "pragma integrity_check", check_callback, 0, 0); if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){ fprintf(stderr,"pid=%d, Integrity check returns %d\n", getpid(), rc); } if( all_stop ){ sqlite_exec(db, "pragma integrity_check", check_callback, 0, 0); } return 0; } /* ** This is the worker thread */ void *worker(void *notUsed){ sqlite *db; int rc; int cnt = 0; while( !all_stop && cnt++<10000 ){ if( cnt%1000==0 ) printf("pid=%d: %d\n", getpid(), cnt); while( (db = sqlite_open(DB_FILE, 0, 0))==0 ) sched_yield(); sqlite_exec(db, "PRAGMA synchronous=OFF", 0, 0, 0); integrity_check(db); if( all_stop ){ sqlite_close(db); break; } /* fprintf(stderr, "pid=%d: BEGIN\n", getpid()); */ rc = sqlite_exec(db, "INSERT INTO t1 VALUES('bogus data')", 0, 0, 0); /* fprintf(stderr, "pid=%d: END rc=%d\n", getpid(), rc); */ sqlite_close(db); } return 0; } /* ** Initialize the database and start the threads */ int main(int argc, char **argv){ sqlite *db; int i, rc; pthread_t aThread[5]; if( strcmp(DB_FILE,":memory:") ) unlink(DB_FILE); db = sqlite_open(DB_FILE, 0, 0); if( db==0 ){ fprintf(stderr,"unable to initialize database\n"); exit(1); } rc = sqlite_exec(db, "CREATE TABLE t1(x);", 0,0,0); if( rc ){ fprintf(stderr,"cannot create table t1: %d\n", rc); exit(1); } sqlite_close(db); for(i=0; i #include #include #include #include #include #include #include #include "sqlite.h" static void do_some_sql(int parent){ char *zErr; int rc = SQLITE_OK; sqlite *db; int cnt = 0; static char zBig[] = "-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" "-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; if( access("./test.db-journal",0)==0 ){ /*printf("pid %d: journal exists. rollback will be required\n",getpid());*/ unlink("test.db-saved"); system("cp test.db test.db-saved"); unlink("test.db-journal-saved"); system("cp test.db-journal test.db-journal-saved"); } db = sqlite_open("./test.db", 0, &zErr); if( db==0 ){ printf("ERROR: %s\n", zErr); if( strcmp(zErr,"database disk image is malformed")==0 ){ kill(parent, SIGKILL); } exit(1); } srand(getpid()); while( rc==SQLITE_OK ){ cnt++; rc = sqlite_exec_printf(db, "INSERT INTO t1 VALUES(%d,'%d%s')", 0, 0, &zErr, rand(), rand(), zBig); } if( rc!=SQLITE_OK ){ printf("ERROR #%d: %s\n", rc, zErr); if( rc==SQLITE_CORRUPT ){ kill(parent, SIGKILL); } } printf("pid %d: cnt=%d\n", getpid(), cnt); } int main(int argc, char **argv){ int i; sqlite *db; char *zErr; int status; int parent = getpid(); unlink("test.db"); unlink("test.db-journal"); db = sqlite_open("test.db", 0, &zErr); if( db==0 ){ printf("Cannot initialize: %s\n", zErr); return 1; } sqlite_exec(db, "CREATE TABLE t1(a,b)", 0, 0, 0); sqlite_close(db); for(i=0; i<10000; i++){ int pid = fork(); if( pid==0 ){ sched_yield(); do_some_sql(parent); return 0; } printf("test %d, pid=%d\n", i, pid); usleep(rand()%10000 + 1000); kill(pid, SIGKILL); waitpid(pid, &status, 0); } return 0; } sqlite-2.8.17/test/lock.test0000644000175000001440000002022410232547612015660 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is database locks. # # $Id: lock.test,v 1.20 2004/02/14 16:31:04 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create an alternative connection to the database # do_test lock-1.0 { sqlite db2 ./test.db set dummy {} } {} do_test lock-1.1 { execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} } {} do_test lock-1.2 { execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} db2 } {} do_test lock-1.3 { execsql {CREATE TABLE t1(a int, b int)} execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} } {t1} #do_test lock-1.4 { # catchsql { # SELECT name FROM sqlite_master WHERE type='table' ORDER BY name # } db2 #} {1 {database schema has changed}} do_test lock-1.5 { catchsql { SELECT name FROM sqlite_master WHERE type='table' ORDER BY name } db2 } {0 t1} do_test lock-1.6 { execsql {INSERT INTO t1 VALUES(1,2)} execsql {SELECT * FROM t1} } {1 2} do_test lock-1.7 { execsql {SELECT * FROM t1} db2 } {1 2} do_test lock-1.8 { execsql {UPDATE t1 SET a=b, b=a} db2 execsql {SELECT * FROM t1} db2 } {2 1} do_test lock-1.9 { execsql {SELECT * FROM t1} } {2 1} do_test lock-1.10 { execsql {BEGIN TRANSACTION} execsql {SELECT * FROM t1} } {2 1} do_test lock-1.11 { catchsql {SELECT * FROM t1} db2 } {1 {database is locked}} do_test lock-1.12 { execsql {ROLLBACK} catchsql {SELECT * FROM t1} } {0 {2 1}} do_test lock-1.13 { execsql {CREATE TABLE t2(x int, y int)} execsql {INSERT INTO t2 VALUES(8,9)} execsql {SELECT * FROM t2} } {8 9} do_test lock-1.14.1 { catchsql {SELECT * FROM t2} db2 } {1 {no such table: t2}} do_test lock-1.14.2 { catchsql {SELECT * FROM t1} db2 } {0 {2 1}} do_test lock-1.15 { catchsql {SELECT * FROM t2} db2 } {0 {8 9}} do_test lock-1.16 { db eval {SELECT * FROM t1} qv { set x [db eval {SELECT * FROM t1}] } set x } {2 1} do_test lock-1.17 { db eval {SELECT * FROM t1} qv { set x [db eval {SELECT * FROM t2}] } set x } {8 9} # You cannot UPDATE a table from within the callback of a SELECT # on that same table because the SELECT has the table locked. # do_test lock-1.18 { db eval {SELECT * FROM t1} qv { set r [catch {db eval {UPDATE t1 SET a=b, b=a}} msg] lappend r $msg } set r } {1 {database table is locked}} # But you can UPDATE a different table from the one that is used in # the SELECT. # do_test lock-1.19 { db eval {SELECT * FROM t1} qv { set r [catch {db eval {UPDATE t2 SET x=y, y=x}} msg] lappend r $msg } set r } {0 {}} do_test lock-1.20 { execsql {SELECT * FROM t2} } {9 8} # It is possible to do a SELECT of the same table within the # callback of another SELECT on that same table because two # or more read-only cursors can be open at once. # do_test lock-1.21 { db eval {SELECT * FROM t1} qv { set r [catch {db eval {SELECT a FROM t1}} msg] lappend r $msg } set r } {0 2} # Under UNIX you can do two SELECTs at once with different database # connections, because UNIX supports reader/writer locks. Under windows, # this is not possible. # if {$::tcl_platform(platform)=="unix"} { do_test lock-1.22 { db eval {SELECT * FROM t1} qv { set r [catch {db2 eval {SELECT a FROM t1}} msg] lappend r $msg } set r } {0 2} } integrity_check lock-1.23 # If one thread has a transaction another thread cannot start # a transaction. # do_test lock-2.1 { execsql {BEGIN TRANSACTION} set r [catch {execsql {BEGIN TRANSACTION} db2} msg] lappend r $msg } {1 {database is locked}} # Nor can the other thread do a query. # do_test lock-2.2 { set r [catch {execsql {SELECT * FROM t2} db2} msg] lappend r $msg } {1 {database is locked}} # If the other thread (the one that does not hold the transaction) # tries to start a transaction, we get a busy callback. # do_test lock-2.3 { proc callback {args} { set ::callback_value $args break } set ::callback_value {} db2 busy callback set r [catch {execsql {BEGIN TRANSACTION} db2} msg] lappend r $msg lappend r $::callback_value } {1 {database is locked} {{} 1}} do_test lock-2.4 { proc callback {file count} { lappend ::callback_value $count if {$count>4} break } set ::callback_value {} db2 busy callback set r [catch {execsql {BEGIN TRANSACTION} db2} msg] lappend r $msg lappend r $::callback_value } {1 {database is locked} {1 2 3 4 5}} do_test lock-2.5 { proc callback {file count} { lappend ::callback_value $count if {$count>4} break } set ::callback_value {} db2 busy callback set r [catch {execsql {SELECT * FROM t1} db2} msg] lappend r $msg lappend r $::callback_value } {1 {database is locked} {1 2 3 4 5}} # In this test, the 3rd invocation of the busy callback causes # the first thread to release its transaction. That allows the # second thread to continue. # do_test lock-2.6 { proc callback {file count} { lappend ::callback_value $count if {$count>2} { execsql {ROLLBACK} } } set ::callback_value {} db2 busy callback set r [catch {execsql {SELECT * FROM t2} db2} msg] lappend r $msg lappend r $::callback_value } {0 {9 8} {1 2 3}} do_test lock-2.7 { execsql {BEGIN TRANSACTION} proc callback {file count} { lappend ::callback_value $count if {$count>2} { execsql {ROLLBACK} } } set ::callback_value {} db2 busy callback set r [catch {execsql {BEGIN TRANSACTION} db2} msg] execsql {ROLLBACK} db2 lappend r $msg lappend r $::callback_value } {0 {} {1 2 3}} # Test the built-in busy timeout handler # do_test lock-2.8 { db2 timeout 400 execsql BEGIN catchsql BEGIN db2 } {1 {database is locked}} do_test lock-2.9 { db2 timeout 0 execsql COMMIT } {} integrity_check lock-2.10 # Try to start two transactions in a row # do_test lock-3.1 { execsql {BEGIN TRANSACTION} set r [catch {execsql {BEGIN TRANSACTION}} msg] execsql {ROLLBACK} lappend r $msg } {1 {cannot start a transaction within a transaction}} integrity_check lock-3.2 # Make sure the busy handler and error messages work when # opening a new pointer to the database while another pointer # has the database locked. # do_test lock-4.1 { db2 close catch {db eval ROLLBACK} db eval BEGIN sqlite db2 ./test.db set rc [catch {db2 eval {SELECT * FROM t1}} msg] lappend rc $msg } {1 {database is locked}} do_test lock-4.2 { set ::callback_value {} set rc [catch {db2 eval {SELECT * FROM t1}} msg] lappend rc $msg $::callback_value } {1 {database is locked} {}} do_test lock-4.3 { proc callback {file count} { lappend ::callback_value $count if {$count>4} break } db2 busy callback set rc [catch {db2 eval {SELECT * FROM t1}} msg] lappend rc $msg $::callback_value } {1 {database is locked} {1 2 3 4 5}} execsql {ROLLBACK} # When one thread is writing, other threads cannot read. Except if the # writing thread is writing to its temporary tables, the other threads # can still read. # proc tx_exec {sql} { db2 eval $sql } do_test lock-5.1 { execsql { SELECT * FROM t1 } } {2 1} do_test lock-5.2 { db function tx_exec tx_exec catchsql { INSERT INTO t1(a,b) SELECT 3, tx_exec('SELECT y FROM t2 LIMIT 1'); } } {1 {database is locked}} do_test lock-5.3 { execsql { CREATE TEMP TABLE t3(x); SELECT * FROM t3; } } {} do_test lock-5.4 { catchsql { INSERT INTO t3 SELECT tx_exec('SELECT y FROM t2 LIMIT 1'); } } {0 {}} do_test lock-5.5 { execsql { SELECT * FROM t3; } } {8} do_test lock-5.6 { catchsql { UPDATE t1 SET a=tx_exec('SELECT x FROM t2'); } } {1 {database is locked}} do_test lock-5.7 { execsql { SELECT * FROM t1; } } {2 1} do_test lock-5.8 { catchsql { UPDATE t3 SET x=tx_exec('SELECT x FROM t2'); } } {0 {}} do_test lock-5.9 { execsql { SELECT * FROM t3; } } {9} do_test lock-999.1 { rename db2 {} } {} finish_test sqlite-2.8.17/test/malloc.test0000644000175000001440000001536710232547612016213 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file attempts to check the library in an out-of-memory situation. # When compiled with -DMEMORY_DEBUG=1, the SQLite library accepts a special # command (sqlite_malloc_fail N) which causes the N-th malloc to fail. This # special feature is used to see what happens in the library if a malloc # were to really fail due to an out-of-memory situation. # # $Id: malloc.test,v 1.6 2004/02/14 01:39:50 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # if {[info command sqlite_malloc_stat]==""} { puts "Skipping malloc tests: not compiled with -DMEMORY_DEBUG..." finish_test return } for {set go 1; set i 1} {$go} {incr i} { do_test malloc-1.$i { sqlite_malloc_fail 0 catch {db close} catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite_malloc_fail $i set v [catch {sqlite db test.db} msg] if {$v} { set msg "" } else { set v [catch {execsql { CREATE TABLE t1( a int, b float, c double, d text, e varchar(20), primary key(a,b,c) ); CREATE INDEX i1 ON t1(a,b); INSERT INTO t1 VALUES(1,2.3,4.5,'hi','there'); INSERT INTO t1 VALUES(6,7.0,0.8,'hello','out yonder'); SELECT * FROM t1; SELECT avg(b) FROM t1 GROUP BY a HAVING b>20.0; DELETE FROM t1 WHERE a IN (SELECT min(a) FROM t1); SELECT count(*) FROM t1; }} msg] } set leftover [lindex [sqlite_malloc_stat] 2] if {$leftover>0} { if {$leftover>1} {puts "\nLeftover: $leftover\nReturn=$v Message=$msg"} set ::go 0 set v {1 1} } else { set v2 [expr {$msg=="" || $msg=="out of memory"}] if {!$v2} {puts "\nError message returned: $msg"} lappend v $v2 } } {1 1} } set fd [open ./data.tmp w] for {set i 1} {$i<=20} {incr i} { puts $fd "$i\t[expr {$i*$i}]\t[expr {100-$i}] abcdefghijklmnopqrstuvwxyz" } close $fd for {set go 1; set i 1} {$go} {incr i} { do_test malloc-2.$i { sqlite_malloc_fail 0 catch {db close} catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite_malloc_fail $i set v [catch {sqlite db test.db} msg] if {$v} { set msg "" } else { set v [catch {execsql { CREATE TABLE t1(a int, b int, c int); CREATE INDEX i1 ON t1(a,b); COPY t1 FROM 'data.tmp'; SELECT 'stuff', count(*) as 'other stuff', max(a+10) FROM t1; UPDATE t1 SET b=b||b||b||b; UPDATE t1 SET b=a WHERE a in (10,12,22); INSERT INTO t1(c,b,a) VALUES(20,10,5); INSERT INTO t1 SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a<10); DELETE FROM t1 WHERE a>=10; DROP INDEX i1; DELETE FROM t1; }} msg] } set leftover [lindex [sqlite_malloc_stat] 2] if {$leftover>0} { if {$leftover>1} {puts "\nLeftover: $leftover\nReturn=$v Message=$msg"} set ::go 0 set v {1 1} } else { set v2 [expr {$msg=="" || $msg=="out of memory"}] if {!$v2} {puts "\nError message returned: $msg"} lappend v $v2 } } {1 1} } set fd [open ./data.tmp w] for {set i 1} {$i<=10} {incr i} { puts $fd "$i\t[expr {$i*$i}]\t[expr {100-$i}]" } close $fd for {set go 1; set i 1} {$go} {incr i} { do_test malloc-3.$i { sqlite_malloc_fail 0 catch {db close} catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite_malloc_fail $i set v [catch {sqlite db test.db} msg] if {$v} { set msg "" } else { set v [catch {execsql { BEGIN TRANSACTION; CREATE TABLE t1(a int, b int, c int); CREATE INDEX i1 ON t1(a,b); COPY t1 FROM 'data.tmp'; INSERT INTO t1(c,b,a) VALUES(20,10,5); DELETE FROM t1 WHERE a>=10; DROP INDEX i1; DELETE FROM t1; ROLLBACK; }} msg] } set leftover [lindex [sqlite_malloc_stat] 2] if {$leftover>0} { if {$leftover>1} {puts "\nLeftover: $leftover\nReturn=$v Message=$msg"} set ::go 0 set v {1 1} } else { set v2 [expr {$msg=="" || $msg=="out of memory"}] if {!$v2} {puts "\nError message returned: $msg"} lappend v $v2 } } {1 1} } for {set go 1; set i 1} {$go} {incr i} { do_test malloc-4.$i { sqlite_malloc_fail 0 catch {db close} catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite_malloc_fail $i set v [catch {sqlite db test.db} msg] if {$v} { set msg "" } else { set v [catch {execsql { BEGIN TRANSACTION; CREATE TABLE t1(a int, b int, c int); CREATE INDEX i1 ON t1(a,b); COPY t1 FROM 'data.tmp'; UPDATE t1 SET b=a WHERE a in (10,12,22); INSERT INTO t1 SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a<10); DROP INDEX i1; DELETE FROM t1; COMMIT; }} msg] } set leftover [lindex [sqlite_malloc_stat] 2] if {$leftover>0} { if {$leftover>1} {puts "\nLeftover: $leftover\nReturn=$v Message=$msg"} set ::go 0 set v {1 1} } else { set v2 [expr {$msg=="" || $msg=="out of memory"}] if {!$v2} {puts "\nError message returned: $msg"} lappend v $v2 } } {1 1} } for {set go 1; set i 1} {$go} {incr i} { do_test malloc-5.$i { sqlite_malloc_fail 0 catch {db close} catch {file delete -force test.db} catch {file delete -force test.db-journal} sqlite_malloc_fail $i set v [catch {sqlite db test.db} msg] if {$v} { set msg "" } else { set v [catch {execsql { BEGIN TRANSACTION; CREATE TABLE t1(a,b); CREATE TABLE t2(x,y); CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN INSERT INTO t2(x,y) VALUES(new.rowid,1); END; INSERT INTO t1(a,b) VALUES(2,3); COMMIT; }} msg] } set leftover [lindex [sqlite_malloc_stat] 2] if {$leftover>0} { if {$leftover>1} {puts "\nLeftover: $leftover\nReturn=$v Message=$msg"} set ::go 0 set v {1 1} } else { set v2 [expr {$msg=="" || $msg=="out of memory"}] if {!$v2} {puts "\nError message returned: $msg"} lappend v $v2 } } {1 1} } sqlite_malloc_fail 0 finish_test sqlite-2.8.17/test/all.test0000644000175000001440000000515610232547612015507 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file runs all tests. # # $Id: all.test,v 1.19 2003/02/16 22:21:33 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl rename finish_test really_finish_test proc finish_test {} {memleak_check} if {[file exists ./sqlite_test_count]} { set COUNT [exec cat ./sqlite_test_count] } else { set COUNT 4 } if {[llength $argv]>0} { foreach {name value} $argv { switch -- $name { -count { set COUNT $value } -quick { set ISQUICK $value } default { puts stderr "Unknown option: $name" exit } } } } set argv {} # LeakList will hold a list of the number of unfreed mallocs after # each round of the test. This number should be constant. If it # grows, it may mean there is a memory leak in the library. # set LeakList {} set EXCLUDE { all.test quick.test malloc.test misuse.test memleak.test } # btree2.test for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} { set btree_native_byte_order [expr {($Counter>>1)&0x1}] if {$Counter%2} { set ::SETUP_SQL {PRAGMA default_synchronous=off;} } else { catch {unset ::SETUP_SQL} } foreach testfile [lsort -dictionary [glob $testdir/*.test]] { set tail [file tail $testfile] if {[lsearch -exact $EXCLUDE $tail]>=0} continue source $testfile catch {db close} if {$sqlite_open_file_count>0} { puts "$tail did not close all files: $sqlite_open_file_count" incr nErr lappend ::failList $tail } } if {[info exists Leak]} { lappend LeakList $Leak } } # Do one last test to look for a memory leak in the library. This will # only work if SQLite is compiled with the -DMEMORY_DEBUG=1 flag. # if {$LeakList!=""} { puts -nonewline memory-leak-test... incr ::nTest foreach x $LeakList { if {$x!=[lindex $LeakList 0]} { puts " failed!" puts "Expected: all values to be the same" puts " Got: $LeakList" incr ::nErr lappend ::failList memory-leak-test break } } puts " Ok" } # Run the malloc tests and the misuse test after memory leak detection. # Both tests leak memory. # catch {source $testdir/misuse.test} catch {source $testdir/malloc.test} catch {db close} set sqlite_open_file_count 0 really_finish_test sqlite-2.8.17/test/where.test0000644000175000001440000004210310232547612016042 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the use of indices in WHERE clases. # # $Id: where.test,v 1.17 2003/06/15 23:42:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # do_test where-1.0 { execsql { CREATE TABLE t1(w int, x int, y int); CREATE TABLE t2(p int, q int, r int, s int); } for {set i 1} {$i<=100} {incr i} { set w $i set x [expr {int(log($i)/log(2))}] set y [expr {$i*$i + 2*$i + 1}] execsql "INSERT INTO t1 VALUES($w,$x,$y)" } execsql { INSERT INTO t2 SELECT 101-w, x, (SELECT max(y) FROM t1)+1-y, y FROM t1; CREATE INDEX i1w ON t1(w); CREATE INDEX i1xy ON t1(x,y); CREATE INDEX i2p ON t2(p); CREATE INDEX i2r ON t2(r); CREATE INDEX i2qs ON t2(q, s); } } {} # Do an SQL statement. Append the search count to the end of the result. # proc count sql { set ::sqlite_search_count 0 return [concat [execsql $sql] $::sqlite_search_count] } # Verify that queries use an index. We are using the special variable # "sqlite_search_count" which tallys the number of executions of MoveTo # and Next operators in the VDBE. By verifing that the search count is # small we can be assured that indices are being used properly. # do_test where-1.1 { count {SELECT x, y FROM t1 WHERE w=10} } {3 121 3} do_test where-1.2 { count {SELECT x, y FROM t1 WHERE w=11} } {3 144 3} do_test where-1.3 { count {SELECT x, y FROM t1 WHERE 11=w} } {3 144 3} do_test where-1.4 { count {SELECT x, y FROM t1 WHERE 11=w AND x>2} } {3 144 3} do_test where-1.5 { count {SELECT x, y FROM t1 WHERE y<200 AND w=11 AND x>2} } {3 144 3} do_test where-1.6 { count {SELECT x, y FROM t1 WHERE y<200 AND x>2 AND w=11} } {3 144 3} do_test where-1.7 { count {SELECT x, y FROM t1 WHERE w=11 AND y<200 AND x>2} } {3 144 3} do_test where-1.8 { count {SELECT x, y FROM t1 WHERE w>10 AND y=144 AND x=3} } {3 144 3} do_test where-1.9 { count {SELECT x, y FROM t1 WHERE y=144 AND w>10 AND x=3} } {3 144 3} do_test where-1.10 { count {SELECT x, y FROM t1 WHERE x=3 AND w>=10 AND y=121} } {3 121 3} do_test where-1.11 { count {SELECT x, y FROM t1 WHERE x=3 AND y=100 AND w<10} } {3 100 3} # New for SQLite version 2.1: Verify that that inequality constraints # are used correctly. # do_test where-1.12 { count {SELECT w FROM t1 WHERE x=3 AND y<100} } {8 3} do_test where-1.13 { count {SELECT w FROM t1 WHERE x=3 AND 100>y} } {8 3} do_test where-1.14 { count {SELECT w FROM t1 WHERE 3=x AND y<100} } {8 3} do_test where-1.15 { count {SELECT w FROM t1 WHERE 3=x AND 100>y} } {8 3} do_test where-1.16 { count {SELECT w FROM t1 WHERE x=3 AND y<=100} } {8 9 5} do_test where-1.17 { count {SELECT w FROM t1 WHERE x=3 AND 100>=y} } {8 9 5} do_test where-1.18 { count {SELECT w FROM t1 WHERE x=3 AND y>225} } {15 3} do_test where-1.19 { count {SELECT w FROM t1 WHERE x=3 AND 225=225} } {14 15 5} do_test where-1.21 { count {SELECT w FROM t1 WHERE x=3 AND 225<=y} } {14 15 5} do_test where-1.22 { count {SELECT w FROM t1 WHERE x=3 AND y>121 AND y<196} } {11 12 5} do_test where-1.23 { count {SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<=196} } {10 11 12 13 9} do_test where-1.24 { count {SELECT w FROM t1 WHERE x=3 AND 121y} } {11 12 5} do_test where-1.25 { count {SELECT w FROM t1 WHERE x=3 AND 121<=y AND 196>=y} } {10 11 12 13 9} # Need to work on optimizing the BETWEEN operator. # # do_test where-1.26 { # count {SELECT w FROM t1 WHERE x=3 AND y BETWEEN 121 AND 196} # } {10 11 12 13 9} do_test where-1.27 { count {SELECT w FROM t1 WHERE x=3 AND y+1==122} } {10 17} do_test where-1.28 { count {SELECT w FROM t1 WHERE x+1=4 AND y+1==122} } {10 99} do_test where-1.29 { count {SELECT w FROM t1 WHERE y==121} } {10 99} do_test where-1.30 { count {SELECT w FROM t1 WHERE w>97} } {98 99 100 6} do_test where-1.31 { count {SELECT w FROM t1 WHERE w>=97} } {97 98 99 100 8} do_test where-1.33 { count {SELECT w FROM t1 WHERE w==97} } {97 3} do_test where-1.34 { count {SELECT w FROM t1 WHERE w+1==98} } {97 99} do_test where-1.35 { count {SELECT w FROM t1 WHERE w<3} } {1 2 4} do_test where-1.36 { count {SELECT w FROM t1 WHERE w<=3} } {1 2 3 6} do_test where-1.37 { count {SELECT w FROM t1 WHERE w+1<=4 ORDER BY w} } {1 2 3 199} do_test where-1.38 { count {SELECT (w) FROM t1 WHERE (w)>(97)} } {98 99 100 6} do_test where-1.39 { count {SELECT (w) FROM t1 WHERE (w)>=(97)} } {97 98 99 100 8} do_test where-1.40 { count {SELECT (w) FROM t1 WHERE (w)==(97)} } {97 3} do_test where-1.41 { count {SELECT (w) FROM t1 WHERE ((w)+(1))==(98)} } {97 99} # Do the same kind of thing except use a join as the data source. # do_test where-2.1 { count { SELECT w, p FROM t2, t1 WHERE x=q AND y=s AND r=8977 } } {34 67 6} do_test where-2.2 { count { SELECT w, p FROM t2, t1 WHERE x=q AND s=y AND r=8977 } } {34 67 6} do_test where-2.3 { count { SELECT w, p FROM t2, t1 WHERE x=q AND s=y AND r=8977 AND w>10 } } {34 67 6} do_test where-2.4 { count { SELECT w, p FROM t2, t1 WHERE p<80 AND x=q AND s=y AND r=8977 AND w>10 } } {34 67 6} do_test where-2.5 { count { SELECT w, p FROM t2, t1 WHERE p<80 AND x=q AND 8977=r AND s=y AND w>10 } } {34 67 6} do_test where-2.6 { count { SELECT w, p FROM t2, t1 WHERE x=q AND p=77 AND s=y AND w>5 } } {24 77 6} do_test where-2.7 { count { SELECT w, p FROM t1, t2 WHERE x=q AND p>77 AND s=y AND w=5 } } {5 96 6} # Lets do a 3-way join. # do_test where-3.1 { count { SELECT A.w, B.p, C.w FROM t1 as A, t2 as B, t1 as C WHERE C.w=101-B.p AND B.r=10202-A.y AND A.w=11 } } {11 90 11 9} do_test where-3.2 { count { SELECT A.w, B.p, C.w FROM t1 as A, t2 as B, t1 as C WHERE C.w=101-B.p AND B.r=10202-A.y AND A.w=12 } } {12 89 12 9} do_test where-3.3 { count { SELECT A.w, B.p, C.w FROM t1 as A, t2 as B, t1 as C WHERE A.w=15 AND B.p=C.w AND B.r=10202-A.y } } {15 86 86 9} # Test to see that the special case of a constant WHERE clause is # handled. # do_test where-4.1 { count { SELECT * FROM t1 WHERE 0 } } {0} do_test where-4.2 { count { SELECT * FROM t1 WHERE 1 LIMIT 1 } } {1 0 4 1} do_test where-4.3 { execsql { SELECT 99 WHERE 0 } } {} do_test where-4.4 { execsql { SELECT 99 WHERE 1 } } {99} # Verify that IN operators in a WHERE clause are handled correctly. # do_test where-5.1 { count { SELECT * FROM t1 WHERE rowid IN (1,2,3,1234) order by 1; } } {1 0 4 2 1 9 3 1 16 0} do_test where-5.2 { count { SELECT * FROM t1 WHERE rowid+0 IN (1,2,3,1234) order by 1; } } {1 0 4 2 1 9 3 1 16 199} do_test where-5.3 { count { SELECT * FROM t1 WHERE w IN (-1,1,2,3) order by 1; } } {1 0 4 2 1 9 3 1 16 10} do_test where-5.4 { count { SELECT * FROM t1 WHERE w+0 IN (-1,1,2,3) order by 1; } } {1 0 4 2 1 9 3 1 16 199} do_test where-5.5 { count { SELECT * FROM t1 WHERE rowid IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 1} do_test where-5.6 { count { SELECT * FROM t1 WHERE rowid+0 IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 199} do_test where-5.7 { count { SELECT * FROM t1 WHERE w IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 7} do_test where-5.8 { count { SELECT * FROM t1 WHERE w+0 IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 199} do_test where-5.9 { count { SELECT * FROM t1 WHERE x IN (1,7) ORDER BY 1; } } {2 1 9 3 1 16 6} do_test where-5.10 { count { SELECT * FROM t1 WHERE x+0 IN (1,7) ORDER BY 1; } } {2 1 9 3 1 16 199} do_test where-5.11 { count { SELECT * FROM t1 WHERE y IN (6400,8100) ORDER BY 1; } } {79 6 6400 89 6 8100 199} do_test where-5.12 { count { SELECT * FROM t1 WHERE x=6 AND y IN (6400,8100) ORDER BY 1; } } {79 6 6400 89 6 8100 74} do_test where-5.13 { count { SELECT * FROM t1 WHERE x IN (1,7) AND y NOT IN (6400,8100) ORDER BY 1; } } {2 1 9 3 1 16 6} do_test where-5.14 { count { SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,10) ORDER BY 1; } } {2 1 9 6} # This procedure executes the SQL. Then it checks the generated program # for the SQL and appends a "nosort" to the result if the program contains the # SortCallback opcode. If the program does not contain the SortCallback # opcode it appends "sort" # proc cksort {sql} { set data [execsql $sql] set prog [execsql "EXPLAIN $sql"] if {[regexp SortCallback $prog]} {set x sort} {set x nosort} lappend data $x return $data } # Check out the logic that attempts to implement the ORDER BY clause # using an index rather than by sorting. # do_test where-6.1 { execsql { CREATE TABLE t3(a,b,c); CREATE INDEX t3a ON t3(a); CREATE INDEX t3bc ON t3(b,c); CREATE INDEX t3acb ON t3(a,c,b); INSERT INTO t3 SELECT w, 101-w, y FROM t1; SELECT count(*), sum(a), sum(b), sum(c) FROM t3; } } {100 5050 5050 348550} do_test where-6.2 { cksort { SELECT * FROM t3 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test where-6.3 { cksort { SELECT * FROM t3 ORDER BY a+1 LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort} do_test where-6.4 { cksort { SELECT * FROM t3 WHERE a<10 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test where-6.5 { cksort { SELECT * FROM t3 WHERE a>0 AND a<10 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test where-6.6 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test where-6.7 { cksort { SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort} do_test where-6.8 { cksort { SELECT * FROM t3 WHERE a IN (3,5,7,1,9,4,2) ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort} do_test where-6.9.1 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a LIMIT 3 } } {1 100 4 nosort} do_test where-6.9.2 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c LIMIT 3 } } {1 100 4 nosort} do_test where-6.9.3 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c LIMIT 3 } } {1 100 4 nosort} do_test where-6.9.4 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC LIMIT 3 } } {1 100 4 nosort} do_test where-6.9.5 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC, c DESC LIMIT 3 } } {1 100 4 nosort} do_test where-6.9.6 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c DESC LIMIT 3 } } {1 100 4 nosort} do_test where-6.9.7 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c,a LIMIT 3 } } {1 100 4 sort} do_test where-6.9.8 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC, c ASC LIMIT 3 } } {1 100 4 sort} do_test where-6.9.9 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a ASC, c DESC LIMIT 3 } } {1 100 4 sort} do_test where-6.10 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a LIMIT 3 } } {1 100 4 nosort} do_test where-6.11 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c LIMIT 3 } } {1 100 4 nosort} do_test where-6.12 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c,b LIMIT 3 } } {1 100 4 nosort} do_test where-6.13 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a DESC LIMIT 3 } } {100 1 10201 99 2 10000 98 3 9801 nosort} do_test where-6.13.1 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY -a LIMIT 3 } } {100 1 10201 99 2 10000 98 3 9801 sort} do_test where-6.14 { cksort { SELECT * FROM t3 ORDER BY b LIMIT 3 } } {100 1 10201 99 2 10000 98 3 9801 nosort} do_test where-6.15 { cksort { SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t3.a LIMIT 3 } } {1 0 2 1 3 1 nosort} do_test where-6.16 { cksort { SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t1.x, t3.a LIMIT 3 } } {1 0 2 1 3 1 sort} do_test where-6.17 { cksort { SELECT y FROM t1 ORDER BY w COLLATE text LIMIT 3; } } {4 121 10201 sort} do_test where-6.18 { cksort { SELECT y FROM t1 ORDER BY w COLLATE numeric LIMIT 3; } } {4 9 16 sort} do_test where-6.19 { cksort { SELECT y FROM t1 ORDER BY w LIMIT 3; } } {4 9 16 nosort} # Tests for reverse-order sorting. # do_test where-7.1 { cksort { SELECT w FROM t1 WHERE x=3 ORDER BY y; } } {8 9 10 11 12 13 14 15 nosort} do_test where-7.2 { cksort { SELECT w FROM t1 WHERE x=3 ORDER BY y DESC; } } {15 14 13 12 11 10 9 8 nosort} do_test where-7.3 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 ORDER BY y LIMIT 3; } } {10 11 12 nosort} do_test where-7.4 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 ORDER BY y DESC LIMIT 3; } } {15 14 13 nosort} do_test where-7.5 { cksort { SELECT w FROM t1 WHERE x=3 AND y>121 ORDER BY y DESC; } } {15 14 13 12 11 nosort} do_test where-7.6 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 ORDER BY y DESC; } } {15 14 13 12 11 10 nosort} do_test where-7.7 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<196 ORDER BY y DESC; } } {12 11 10 nosort} do_test where-7.8 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<=196 ORDER BY y DESC; } } {13 12 11 10 nosort} do_test where-7.9 { cksort { SELECT w FROM t1 WHERE x=3 AND y>121 AND y<=196 ORDER BY y DESC; } } {13 12 11 nosort} do_test where-7.10 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 AND y<196 ORDER BY y DESC; } } {12 11 10 nosort} do_test where-7.11 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<196 ORDER BY y; } } {10 11 12 nosort} do_test where-7.12 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<=196 ORDER BY y; } } {10 11 12 13 nosort} do_test where-7.13 { cksort { SELECT w FROM t1 WHERE x=3 AND y>121 AND y<=196 ORDER BY y; } } {11 12 13 nosort} do_test where-7.14 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 AND y<196 ORDER BY y; } } {10 11 12 nosort} do_test where-7.15 { cksort { SELECT w FROM t1 WHERE x=3 AND y<81 ORDER BY y; } } {nosort} do_test where-7.16 { cksort { SELECT w FROM t1 WHERE x=3 AND y<=81 ORDER BY y; } } {8 nosort} do_test where-7.17 { cksort { SELECT w FROM t1 WHERE x=3 AND y>256 ORDER BY y; } } {nosort} do_test where-7.18 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=256 ORDER BY y; } } {15 nosort} do_test where-7.19 { cksort { SELECT w FROM t1 WHERE x=3 AND y<81 ORDER BY y DESC; } } {nosort} do_test where-7.20 { cksort { SELECT w FROM t1 WHERE x=3 AND y<=81 ORDER BY y DESC; } } {8 nosort} do_test where-7.21 { cksort { SELECT w FROM t1 WHERE x=3 AND y>256 ORDER BY y DESC; } } {nosort} do_test where-7.22 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=256 ORDER BY y DESC; } } {15 nosort} do_test where-7.23 { cksort { SELECT w FROM t1 WHERE x=0 AND y<4 ORDER BY y; } } {nosort} do_test where-7.24 { cksort { SELECT w FROM t1 WHERE x=0 AND y<=4 ORDER BY y; } } {1 nosort} do_test where-7.25 { cksort { SELECT w FROM t1 WHERE x=6 AND y>10201 ORDER BY y; } } {nosort} do_test where-7.26 { cksort { SELECT w FROM t1 WHERE x=6 AND y>=10201 ORDER BY y; } } {100 nosort} do_test where-7.27 { cksort { SELECT w FROM t1 WHERE x=0 AND y<4 ORDER BY y DESC; } } {nosort} do_test where-7.28 { cksort { SELECT w FROM t1 WHERE x=0 AND y<=4 ORDER BY y DESC; } } {1 nosort} do_test where-7.29 { cksort { SELECT w FROM t1 WHERE x=6 AND y>10201 ORDER BY y DESC; } } {nosort} do_test where-7.30 { cksort { SELECT w FROM t1 WHERE x=6 AND y>=10201 ORDER BY y DESC; } } {100 nosort} do_test where-8.1 { execsql { CREATE TABLE t4 AS SELECT * FROM t1; CREATE INDEX i4xy ON t4(x,y); } cksort { SELECT w FROM t4 WHERE x=4 and y<1000 ORDER BY y DESC limit 3; } } {30 29 28 nosort} do_test where-8.2 { execsql { DELETE FROM t4; } cksort { SELECT w FROM t4 WHERE x=4 and y<1000 ORDER BY y DESC limit 3; } } {nosort} # Make sure searches with an index work with an empty table. # do_test where-9.1 { execsql { CREATE TABLE t5(x PRIMARY KEY); SELECT * FROM t5 WHERE x<10; } } {} do_test where-9.2 { execsql { SELECT * FROM t5 WHERE x<10 ORDER BY x DESC; } } {} do_test where-9.3 { execsql { SELECT * FROM t5 WHERE x=10; } } {} do_test where-10.1 { execsql { SELECT 1 WHERE abs(random())<0 } } {} do_test where-10.2 { proc tclvar_func {vname} {return [set ::$vname]} db function tclvar tclvar_func set ::v1 0 execsql { SELECT count(*) FROM t1 WHERE tclvar('v1'); } } {0} do_test where-10.3 { set ::v1 1 execsql { SELECT count(*) FROM t1 WHERE tclvar('v1'); } } {100} do_test where-10.4 { set ::v1 1 proc tclvar_func {vname} { upvar #0 $vname v set v [expr {!$v}] return $v } execsql { SELECT count(*) FROM t1 WHERE tclvar('v1'); } } {50} integrity_check {where-99.0} finish_test sqlite-2.8.17/test/memleak.test0000644000175000001440000000407610232547612016352 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file runs all tests. # # $Id: memleak.test,v 1.3 2004/02/12 18:46:39 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl rename finish_test really_finish_test proc finish_test {} { catch {db close} memleak_check } if {[file exists ./sqlite_test_count]} { set COUNT [exec cat ./sqlite_test_count] } else { set COUNT 3 } # LeakList will hold a list of the number of unfreed mallocs after # each round of the test. This number should be constant. If it # grows, it may mean there is a memory leak in the library. # set LeakList {} set EXCLUDE { all.test quick.test malloc.test misuse.test memleak.test btree2.test trans.test } if {[sqlite -has-codec]} { lappend EXCLUDE \ attach.test \ attach2.test \ auth.test \ format3.test \ version.test } if {[llength $argv]>0} { set FILELIST $argv set argv {} } else { set FILELIST [lsort -dictionary [glob $testdir/*.test]] } foreach testfile $FILELIST { set tail [file tail $testfile] if {[lsearch -exact $EXCLUDE $tail]>=0} continue set LeakList {} for {set COUNTER 0} {$COUNTER<$COUNT} {incr COUNTER} { source $testfile if {[info exists Leak]} { lappend LeakList $Leak } } if {$LeakList!=""} { puts -nonewline memory-leak-test-$tail... incr ::nTest foreach x $LeakList { if {$x!=[lindex $LeakList 0]} { puts " failed! ($LeakList)" incr ::nErr lappend ::failList memory-leak-test-$tail break } } puts " Ok" } } really_finish_test # Run the malloc tests and the misuse test after memory leak detection. # Both tests leak memory. # #catch {source $testdir/misuse.test} #catch {source $testdir/malloc.test} really_finish_test sqlite-2.8.17/test/in.test0000644000175000001440000001712410232547612015343 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the IN and BETWEEN operator. # # $Id: in.test,v 1.11 2004/01/15 03:30:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Generate the test data we will need for the first squences of tests. # do_test in-1.0 { set fd [open data1.txt w] for {set i 1} {$i<=10} {incr i} { puts $fd "$i\t[expr {int(pow(2,$i))}]" } close $fd execsql { CREATE TABLE t1(a int, b int); COPY t1 FROM 'data1.txt'; } file delete -force data1.txt execsql {SELECT count(*) FROM t1} } {10} # Do basic testing of BETWEEN. # do_test in-1.1 { execsql {SELECT a FROM t1 WHERE b BETWEEN 10 AND 50 ORDER BY a} } {4 5} do_test in-1.2 { execsql {SELECT a FROM t1 WHERE b NOT BETWEEN 10 AND 50 ORDER BY a} } {1 2 3 6 7 8 9 10} do_test in-1.3 { execsql {SELECT a FROM t1 WHERE b BETWEEN a AND a*5 ORDER BY a} } {1 2 3 4} do_test in-1.4 { execsql {SELECT a FROM t1 WHERE b NOT BETWEEN a AND a*5 ORDER BY a} } {5 6 7 8 9 10} do_test in-1.6 { execsql {SELECT a FROM t1 WHERE b BETWEEN a AND a*5 OR b=512 ORDER BY a} } {1 2 3 4 9} do_test in-1.7 { execsql {SELECT a+ 100*(a BETWEEN 1 and 3) FROM t1 ORDER BY b} } {101 102 103 4 5 6 7 8 9 10} # Testing of the IN operator using static lists on the right-hand side. # do_test in-2.1 { execsql {SELECT a FROM t1 WHERE b IN (8,12,16,24,32) ORDER BY a} } {3 4 5} do_test in-2.2 { execsql {SELECT a FROM t1 WHERE b NOT IN (8,12,16,24,32) ORDER BY a} } {1 2 6 7 8 9 10} do_test in-2.3 { execsql {SELECT a FROM t1 WHERE b IN (8,12,16,24,32) OR b=512 ORDER BY a} } {3 4 5 9} do_test in-2.4 { execsql {SELECT a FROM t1 WHERE b NOT IN (8,12,16,24,32) OR b=512 ORDER BY a} } {1 2 6 7 8 9 10} do_test in-2.5 { execsql {SELECT a+100*(b IN (8,16,24)) FROM t1 ORDER BY b} } {1 2 103 104 5 6 7 8 9 10} do_test in-2.6 { set v [catch {execsql {SELECT a FROM t1 WHERE b IN (b+10,20)}} msg] lappend v $msg } {1 {right-hand side of IN operator must be constant}} do_test in-2.7 { set v [catch {execsql {SELECT a FROM t1 WHERE b IN (max(5,10,b),20)}} msg] lappend v $msg } {1 {right-hand side of IN operator must be constant}} do_test in-2.8 { execsql {SELECT a FROM t1 WHERE b IN (8*2,64/2) ORDER BY b} } {4 5} do_test in-2.9 { set v [catch {execsql {SELECT a FROM t1 WHERE b IN (max(5,10),20)}} msg] lappend v $msg } {1 {right-hand side of IN operator must be constant}} do_test in-2.10 { set v [catch {execsql {SELECT a FROM t1 WHERE min(0,b IN (a,30))}} msg] lappend v $msg } {1 {right-hand side of IN operator must be constant}} do_test in-2.11 { set v [catch {execsql {SELECT a FROM t1 WHERE c IN (10,20)}} msg] lappend v $msg } {1 {no such column: c}} # Testing the IN operator where the right-hand side is a SELECT # do_test in-3.1 { execsql { SELECT a FROM t1 WHERE b IN (SELECT b FROM t1 WHERE a<5) ORDER BY a } } {1 2 3 4} do_test in-3.2 { execsql { SELECT a FROM t1 WHERE b IN (SELECT b FROM t1 WHERE a<5) OR b==512 ORDER BY a } } {1 2 3 4 9} do_test in-3.3 { execsql { SELECT a + 100*(b IN (SELECT b FROM t1 WHERE a<5)) FROM t1 ORDER BY b } } {101 102 103 104 5 6 7 8 9 10} # Make sure the UPDATE and DELETE commands work with IN-SELECT # do_test in-4.1 { execsql { UPDATE t1 SET b=b*2 WHERE b IN (SELECT b FROM t1 WHERE a>8) } execsql {SELECT b FROM t1 ORDER BY b} } {2 4 8 16 32 64 128 256 1024 2048} do_test in-4.2 { execsql { DELETE FROM t1 WHERE b IN (SELECT b FROM t1 WHERE a>8) } execsql {SELECT a FROM t1 ORDER BY a} } {1 2 3 4 5 6 7 8} do_test in-4.3 { execsql { DELETE FROM t1 WHERE b NOT IN (SELECT b FROM t1 WHERE a>4) } execsql {SELECT a FROM t1 ORDER BY a} } {5 6 7 8} # Do an IN with a constant RHS but where the RHS has many, many # elements. We need to test that collisions in the hash table # are resolved properly. # do_test in-5.1 { execsql { INSERT INTO t1 VALUES('hello', 'world'); SELECT * FROM t1 WHERE a IN ( 'Do','an','IN','with','a','constant','RHS','but','where','the', 'has','many','elements','We','need','to','test','that', 'collisions','hash','table','are','resolved','properly', 'This','in-set','contains','thirty','one','entries','hello'); } } {hello world} # Make sure the IN operator works with INTEGER PRIMARY KEY fields. # do_test in-6.1 { execsql { CREATE TABLE ta(a INTEGER PRIMARY KEY, b); INSERT INTO ta VALUES(1,1); INSERT INTO ta VALUES(2,2); INSERT INTO ta VALUES(3,3); INSERT INTO ta VALUES(4,4); INSERT INTO ta VALUES(6,6); INSERT INTO ta VALUES(8,8); INSERT INTO ta VALUES(10, 'This is a key that is long enough to require a malloc in the VDBE'); SELECT * FROM ta WHERE a<10; } } {1 1 2 2 3 3 4 4 6 6 8 8} do_test in-6.2 { execsql { CREATE TABLE tb(a INTEGER PRIMARY KEY, b); INSERT INTO tb VALUES(1,1); INSERT INTO tb VALUES(2,2); INSERT INTO tb VALUES(3,3); INSERT INTO tb VALUES(5,5); INSERT INTO tb VALUES(7,7); INSERT INTO tb VALUES(9,9); INSERT INTO tb VALUES(11, 'This is a key that is long enough to require a malloc in the VDBE'); SELECT * FROM tb WHERE a<10; } } {1 1 2 2 3 3 5 5 7 7 9 9} do_test in-6.3 { execsql { SELECT a FROM ta WHERE b IN (SELECT a FROM tb); } } {1 2 3} do_test in-6.4 { execsql { SELECT a FROM ta WHERE b NOT IN (SELECT a FROM tb); } } {4 6 8 10} do_test in-6.5 { execsql { SELECT a FROM ta WHERE b IN (SELECT b FROM tb); } } {1 2 3 10} do_test in-6.6 { execsql { SELECT a FROM ta WHERE b NOT IN (SELECT b FROM tb); } } {4 6 8} do_test in-6.7 { execsql { SELECT a FROM ta WHERE a IN (SELECT a FROM tb); } } {1 2 3} do_test in-6.8 { execsql { SELECT a FROM ta WHERE a NOT IN (SELECT a FROM tb); } } {4 6 8 10} do_test in-6.9 { execsql { SELECT a FROM ta WHERE a IN (SELECT b FROM tb); } } {1 2 3} do_test in-6.10 { execsql { SELECT a FROM ta WHERE a NOT IN (SELECT b FROM tb); } } {4 6 8 10} # Tests of IN operator against empty sets. (Ticket #185) # do_test in-7.1 { execsql { SELECT a FROM t1 WHERE a IN (); } } {} do_test in-7.2 { execsql { SELECT a FROM t1 WHERE a IN (5); } } {5} do_test in-7.3 { execsql { SELECT a FROM t1 WHERE a NOT IN () ORDER BY a; } } {5 6 7 8 hello} do_test in-7.4 { execsql { SELECT a FROM t1 WHERE a IN (5) AND b IN (); } } {} do_test in-7.5 { execsql { SELECT a FROM t1 WHERE a IN (5) AND b NOT IN (); } } {5} do_test in-7.6 { execsql { SELECT a FROM ta WHERE a IN (); } } {} do_test in-7.7 { execsql { SELECT a FROM ta WHERE a NOT IN (); } } {1 2 3 4 6 8 10} do_test in-8.1 { execsql { SELECT b FROM t1 WHERE a IN ('hello','there') } } {world} do_test in-8.2 { execsql { SELECT b FROM t1 WHERE a IN ("hello",'there') } } {world} # Test constructs of the form: expr IN tablename # do_test in-9.1 { execsql { CREATE TABLE t4 AS SELECT a FROM tb; SELECT * FROM t4; } } {1 2 3 5 7 9 11} do_test in-9.2 { execsql { SELECT b FROM t1 WHERE a IN t4; } } {32 128} do_test in-9.3 { execsql { SELECT b FROM t1 WHERE a NOT IN t4; } } {64 256 world} do_test in-9.4 { catchsql { SELECT b FROM t1 WHERE a NOT IN tb; } } {1 {only a single result allowed for a SELECT that is part of an expression}} finish_test sqlite-2.8.17/test/thread1.test0000644000175000001440000000651710232547612016271 0ustar drhusers00000000000000# 2003 December 18 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is multithreading behavior # # $Id: thread1.test,v 1.3 2004/02/11 02:18:07 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Skip this whole file if the thread testing code is not enabled # if {[llength [info command thread_step]]==0 || [sqlite -has-codec]} { finish_test return } # Create some data to work with # do_test thread1-1.1 { execsql { CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,'abcdefgh'); INSERT INTO t1 SELECT a+1, b||b FROM t1; INSERT INTO t1 SELECT a+2, b||b FROM t1; INSERT INTO t1 SELECT a+4, b||b FROM t1; SELECT count(*), max(length(b)) FROM t1; } } {8 64} # Interleave two threads on read access. Then make sure a third # thread can write the database. In other words: # # read-lock A # read-lock B # unlock A # unlock B # write-lock C # # At one point, the write-lock of C would fail on Linux. # do_test thread1-1.2 { thread_create A test.db thread_create B test.db thread_create C test.db thread_compile A {SELECT a FROM t1} thread_step A thread_result A } SQLITE_ROW do_test thread1-1.3 { thread_argc A } 1 do_test thread1-1.4 { thread_argv A 0 } 1 do_test thread1-1.5 { thread_compile B {SELECT b FROM t1} thread_step B thread_result B } SQLITE_ROW do_test thread1-1.6 { thread_argc B } 1 do_test thread1-1.7 { thread_argv B 0 } abcdefgh do_test thread1-1.8 { thread_finalize A thread_result A } SQLITE_OK do_test thread1-1.9 { thread_finalize B thread_result B } SQLITE_OK do_test thread1-1.10 { thread_compile C {CREATE TABLE t2(x,y)} thread_step C thread_result C } SQLITE_DONE do_test thread1-1.11 { thread_finalize C thread_result C } SQLITE_OK do_test thread1-1.12 { catchsql {SELECT name FROM sqlite_master} execsql {SELECT name FROM sqlite_master} } {t1 t2} # Under this scenario: # # read-lock A # read-lock B # unlock A # write-lock C # # Make sure the write-lock fails with SQLITE_BUSY # do_test thread1-2.1 { thread_halt * thread_create A test.db thread_compile A {SELECT a FROM t1} thread_step A thread_result A } SQLITE_ROW do_test thread1-2.2 { thread_create B test.db thread_compile B {SELECT b FROM t1} thread_step B thread_result B } SQLITE_ROW do_test thread1-2.3 { thread_create C test.db thread_compile C {INSERT INTO t2 VALUES(98,99)} thread_step C thread_result C } SQLITE_BUSY do_test thread1-2.4 { execsql {SELECT * FROM t2} } {} do_test thread1-2.5 { thread_finalize A thread_result A } SQLITE_OK do_test thread1-2.6 { thread_step C thread_result C } SQLITE_BUSY do_test thread1-2.7 { execsql {SELECT * FROM t2} } {} do_test thread1-2.8 { thread_finalize B thread_result B } SQLITE_OK do_test thread1-2.9 { thread_step C thread_result C } SQLITE_DONE do_test thread1-2.10 { execsql {SELECT * FROM t2} } {98 99} do_test thread1-2.11 { thread_finalize C thread_result C } SQLITE_OK thread_halt * finish_test sqlite-2.8.17/test/main.test0000644000175000001440000001424610232547612015663 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is exercising the code in main.c. # # $Id: main.test,v 1.14 2003/05/04 17:58:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Tests of the sqlite_complete() function. # do_test main-1.1 { db complete {This is a test} } {0} do_test main-1.2 { db complete { } } {1} do_test main-1.3 { db complete { -- a comment ; } } {1} do_test main-1.4 { db complete { -- a comment ; ; } } {1} do_test main-1.5 { db complete {DROP TABLE 'xyz;} } {0} do_test main-1.6 { db complete {DROP TABLE 'xyz';} } {1} do_test main-1.7 { db complete {DROP TABLE "xyz;} } {0} do_test main-1.8 { db complete {DROP TABLE "xyz';} } {0} do_test main-1.9 { db complete {DROP TABLE "xyz";} } {1} do_test main-1.10 { db complete {DROP TABLE xyz; hi} } {0} do_test main-1.11 { db complete {DROP TABLE xyz; } } {1} do_test main-1.12 { db complete {DROP TABLE xyz; -- hi } } {1} do_test main-1.13 { db complete {DROP TABLE xyz; -- hi } } {1} do_test main-1.14 { db complete {SELECT a-b FROM t1; } } {1} do_test main-1.15 { db complete {SELECT a-b FROM t1 } } {0} do_test main-1.16 { db complete { CREATE TABLE abc(x,y); } } {1} do_test main-1.17 { db complete { CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; } } {0} do_test main-1.18 { db complete { CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; END; } } {1} do_test main-1.19 { db complete { CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; unknown command; } } {0} do_test main-1.20 { db complete { CREATE TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr; } } {0} do_test main-1.21 { db complete { CREATE TRIGGER xyz AFTER DELETE end BEGIN SELECT a, b FROM end; } } {0} do_test main-1.22 { db complete { CREATE TRIGGER xyz AFTER DELETE end BEGIN SELECT a, b FROM end; END; } } {1} do_test main-1.23 { db complete { CREATE TRIGGER xyz AFTER DELETE end BEGIN SELECT a, b FROM end; END; SELECT a, b FROM end; } } {1} do_test main-1.24 { db complete { CREATE TRIGGER xyz AFTER DELETE [;end;] BEGIN UPDATE pqr; } } {0} do_test main-1.25 { db complete { CREATE TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=[;end;];;; } } {0} do_test main-1.26 { db complete { CREATE -- a comment TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {0} do_test main-1.27.1 { db complete { CREATE -- a comment TRIGGERX xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {1} do_test main-1.27.2 { db complete { CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {0} do_test main-1.27.3 { db complete { /* */ EXPLAIN -- A comment CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {0} do_test main-1.27.4 { db complete { BOGUS token CREATE TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {1} do_test main-1.27.5 { db complete { EXPLAIN CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {0} do_test main-1.28 { db complete { CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; } } {0} do_test main-1.29 { db complete { CREATE TRIGGER xyz AFTER DELETE backend BEGIN UPDATE pqr SET a=5; EXPLAIN select * from xyz; } } {0} do_test main-1.30 { db complete { CREATE TABLE /* In comment ; */ } } {0} do_test main-1.31 { db complete { CREATE TABLE /* In comment ; */ hi; } } {1} do_test main-1.31 { db complete { CREATE TABLE /* In comment ; */; } } {1} do_test main-1.32 { db complete { stuff; /* CREATE TABLE multiple lines of text */ } } {1} do_test main-1.33 { db complete { /* CREATE TABLE multiple lines of text; } } {0} do_test main-1.34 { db complete { /* CREATE TABLE multiple lines "*/ of text; } } {1} do_test main-1.35 { db complete {hi /**/ there;} } {1} do_test main-1.36 { db complete {hi there/***/;} } {1} # Try to open a database with a corrupt database file. # do_test main-2.0 { catch {db close} file delete -force test.db set fd [open test.db w] puts $fd hi! close $fd set v [catch {sqlite db test.db} msg] if {$v} {lappend v $msg} {lappend v {}} } {0 {}} # Here are some tests for tokenize.c. # do_test main-3.1 { catch {db close} foreach f [glob -nocomplain testdb/*] {file delete -force $f} file delete -force testdb sqlite db testdb set v [catch {execsql {SELECT * from T1 where x!!5}} msg] lappend v $msg } {1 {unrecognized token: "!!"}} do_test main-3.2 { catch {db close} foreach f [glob -nocomplain testdb/*] {file delete -force $f} file delete -force testdb sqlite db testdb set v [catch {execsql {SELECT * from T1 where @x}} msg] lappend v $msg } {1 {unrecognized token: "@"}} do_test main-3.3 { catch {db close} foreach f [glob -nocomplain testdb/*] {file delete -force $f} file delete -force testdb sqlite db testdb execsql { create table T1(X REAL); insert into T1 values(0.5); insert into T1 values(0.5e2); insert into T1 values(0.5e-002); insert into T1 values(5e-002); insert into T1 values(-5.0e-2); insert into T1 values(-5.1e-2); insert into T1 values(0.5e2); insert into T1 values(0.5E+02); insert into T1 values(5E+02); insert into T1 values(5.0E+03); select x*10 from T1 order by x*5; } } {-0.51 -0.5 0.05 0.5 5 500 500 500 5000 50000} do_test main-3.4 { set v [catch {execsql {create bogus}} msg] lappend v $msg } {1 {near "bogus": syntax error}} do_test main-3.5 { set v [catch {execsql {create}} msg] lappend v $msg } {1 {near "create": syntax error}} finish_test sqlite-2.8.17/test/laststmtchanges.test0000644000175000001440000001711510232547612020141 0ustar drhusers00000000000000# The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # Tests to make sure that value returned by last_statement_change_count() # (LSCC) is updated properly, especially inside triggers # # Note 1: LSCC remains constant within a statement and only updates once # the statement is finished (triggers count as part of statement) # Note 2: LSCC is changed within the context of a trigger # much like last_insert_rowid() (see lastinsert.test), # but is restored once the trigger exits # Note 3: LSCC is not changed by a change to a view (since everything # is done within instead of trigger context) # set testdir [file dirname $argv0] source $testdir/tester.tcl # ---------------------------------------------------------------------------- # 1.x - basic tests (no triggers) # LSCC set properly after insert do_test laststmtchanges-1.1 { catchsql { create table t0 (x); insert into t0 values (1); insert into t0 values (1); insert into t0 values (2); insert into t0 values (2); insert into t0 values (1); insert into t0 values (1); insert into t0 values (1); insert into t0 values (2); select last_statement_change_count(); } } {0 1} # LSCC set properly after update do_test laststmtchanges-1.2 { catchsql { update t0 set x=3 where x=1; select last_statement_change_count(); } } {0 5} # LSCC unchanged within an update statement do_test laststmtchanges-1.3 { catchsql { update t0 set x=x+last_statement_change_count() where x=3; select count() from t0 where x=8; } } {0 5} # LSCC set properly after update on table where no rows changed do_test laststmtchanges-1.4 { catchsql { update t0 set x=77 where x=88; select last_statement_change_count(); } } {0 0} # LSCC set properly after delete from table do_test laststmtchanges-1.5 { catchsql { delete from t0 where x=2; select last_statement_change_count(); } } {0 3} # ---------------------------------------------------------------------------- # 2.x - tests with after insert trigger # LSCC changed properly after insert into table containing after trigger do_test laststmtchanges-2.1 { catchsql { create table t1 (k integer primary key); create table t2 (k integer primary key, v1, v2); create trigger r1 after insert on t1 for each row begin insert into t2 values (NULL, last_statement_change_count(), NULL); update t0 set x=x; update t2 set v2=last_statement_change_count(); end; insert into t1 values (77); select last_statement_change_count(); } } {0 1} # LSCC unchanged upon entry into after insert trigger do_test laststmtchanges-2.2 { catchsql { select v1 from t2; } } {0 3} # LSCC changed properly by update within context of after insert trigger do_test laststmtchanges-2.3 { catchsql { select v2 from t2; } } {0 5} # ---------------------------------------------------------------------------- # 3.x - tests with after update trigger # LSCC changed properly after update into table containing after trigger do_test laststmtchanges-3.1 { catchsql { drop trigger r1; delete from t2; delete from t2; create trigger r1 after update on t1 for each row begin insert into t2 values (NULL, last_statement_change_count(), NULL); delete from t0 where oid=1 or oid=2; update t2 set v2=last_statement_change_count(); end; update t1 set k=k; select last_statement_change_count(); } } {0 1} # LSCC unchanged upon entry into after update trigger do_test laststmtchanges-3.2 { catchsql { select v1 from t2; } } {0 0} # LSCC changed properly by delete within context of after update trigger do_test laststmtchanges-3.3 { catchsql { select v2 from t2; } } {0 2} # ---------------------------------------------------------------------------- # 4.x - tests with before delete trigger # LSCC changed properly on delete from table containing before trigger do_test laststmtchanges-4.1 { catchsql { drop trigger r1; delete from t2; delete from t2; create trigger r1 before delete on t1 for each row begin insert into t2 values (NULL, last_statement_change_count(), NULL); insert into t0 values (5); update t2 set v2=last_statement_change_count(); end; delete from t1; select last_statement_change_count(); } } {0 1} # LSCC unchanged upon entry into before delete trigger do_test laststmtchanges-4.2 { catchsql { select v1 from t2; } } {0 0} # LSCC changed properly by insert within context of before delete trigger do_test laststmtchanges-4.3 { catchsql { select v2 from t2; } } {0 1} # ---------------------------------------------------------------------------- # 5.x - complex tests with temporary tables and nested instead of triggers do_test laststmtchanges-5.1 { catchsql { drop table t0; drop table t1; drop table t2; create temp table t0(x); create temp table t1 (k integer primary key); create temp table t2 (k integer primary key); create temp view v1 as select * from t1; create temp view v2 as select * from t2; create temp table n1 (k integer primary key, n); create temp table n2 (k integer primary key, n); insert into t0 values (1); insert into t0 values (2); insert into t0 values (1); insert into t0 values (1); insert into t0 values (1); insert into t0 values (2); insert into t0 values (2); insert into t0 values (1); create temp trigger r1 instead of insert on v1 for each row begin insert into n1 values (NULL, last_statement_change_count()); update t0 set x=x*10 where x=1; insert into n1 values (NULL, last_statement_change_count()); insert into t1 values (NEW.k); insert into n1 values (NULL, last_statement_change_count()); update t0 set x=x*10 where x=0; insert into v2 values (100+NEW.k); insert into n1 values (NULL, last_statement_change_count()); end; create temp trigger r2 instead of insert on v2 for each row begin insert into n2 values (NULL, last_statement_change_count()); insert into t2 values (1000+NEW.k); insert into n2 values (NULL, last_statement_change_count()); update t0 set x=x*100 where x=0; insert into n2 values (NULL, last_statement_change_count()); delete from t0 where x=2; insert into n2 values (NULL, last_statement_change_count()); end; insert into t1 values (77); select last_statement_change_count(); } } {0 1} do_test laststmtchanges-5.2 { catchsql { delete from t1 where k=88; select last_statement_change_count(); } } {0 0} do_test laststmtchanges-5.3 { catchsql { insert into v1 values (5); select last_statement_change_count(); } } {0 0} do_test laststmtchanges-5.4 { catchsql { select n from n1; } } {0 {0 5 1 0}} do_test laststmtchanges-5.5 { catchsql { select n from n2; } } {0 {0 1 0 3}} finish_test sqlite-2.8.17/test/null.test0000644000175000001440000001230510232547612015703 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for proper treatment of the special # value NULL. # set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table and some data to work with. # do_test null-1.0 { execsql { begin; create table t1(a,b,c); insert into t1 values(1,0,0); insert into t1 values(2,0,1); insert into t1 values(3,1,0); insert into t1 values(4,1,1); insert into t1 values(5,null,0); insert into t1 values(6,null,1); insert into t1 values(7,null,null); commit; select * from t1; } } {1 0 0 2 0 1 3 1 0 4 1 1 5 {} 0 6 {} 1 7 {} {}} # Check for how arithmetic expressions handle NULL # do_test null-1.1 { execsql { select ifnull(a+b,99) from t1; } } {1 2 4 5 99 99 99} do_test null-1.2 { execsql { select ifnull(b*c,99) from t1; } } {0 0 0 1 99 99 99} # Check to see how the CASE expression handles NULL values. The # first WHEN for which the test expression is TRUE is selected. # FALSE and UNKNOWN test expressions are skipped. # do_test null-2.1 { execsql { select ifnull(case when b<>0 then 1 else 0 end, 99) from t1; } } {0 0 1 1 0 0 0} do_test null-2.2 { execsql { select ifnull(case when not b<>0 then 1 else 0 end, 99) from t1; } } {1 1 0 0 0 0 0} do_test null-2.3 { execsql { select ifnull(case when b<>0 and c<>0 then 1 else 0 end, 99) from t1; } } {0 0 0 1 0 0 0} do_test null-2.4 { execsql { select ifnull(case when not (b<>0 and c<>0) then 1 else 0 end, 99) from t1; } } {1 1 1 0 1 0 0} do_test null-2.5 { execsql { select ifnull(case when b<>0 or c<>0 then 1 else 0 end, 99) from t1; } } {0 1 1 1 0 1 0} do_test null-2.6 { execsql { select ifnull(case when not (b<>0 or c<>0) then 1 else 0 end, 99) from t1; } } {1 0 0 0 0 0 0} do_test null-2.7 { execsql { select ifnull(case b when c then 1 else 0 end, 99) from t1; } } {1 0 0 1 0 0 0} do_test null-2.8 { execsql { select ifnull(case c when b then 1 else 0 end, 99) from t1; } } {1 0 0 1 0 0 0} # Check to see that NULL values are ignored in aggregate functions. # (except for min().) # do_test null-3.1 { execsql { select count(*), count(b), count(c), sum(b), sum(c), avg(b), avg(c), min(b), max(b) from t1; } } {7 4 6 2 3 0.5 0.5 0 1} # Check to see how WHERE clauses handle NULL values. A NULL value # is the same as UNKNOWN. The WHERE clause should only select those # rows that are TRUE. FALSE and UNKNOWN rows are rejected. # do_test null-4.1 { execsql { select a from t1 where b<10 } } {1 2 3 4} do_test null-4.2 { execsql { select a from t1 where not b>10 } } {1 2 3 4} do_test null-4.3 { execsql { select a from t1 where b<10 or c=1; } } {1 2 3 4 6} do_test null-4.4 { execsql { select a from t1 where b<10 and c=1; } } {2 4} do_test null-4.5 { execsql { select a from t1 where not (b<10 and c=1); } } {1 3 5} # The DISTINCT keyword on a SELECT statement should treat NULL values # as distinct # do_test null-5.1 { execsql { select distinct b from t1 order by b; } } {{} 0 1} # A UNION to two queries should treat NULL values # as distinct # do_test null-6.1 { execsql { select b from t1 union select c from t1 order by c; } } {{} 0 1} # The UNIQUE constraint only applies to non-null values # do_test null-7.1 { execsql { create table t2(a, b unique on conflict ignore); insert into t2 values(1,1); insert into t2 values(2,null); insert into t2 values(3,null); insert into t2 values(4,1); select a from t2; } } {1 2 3} do_test null-7.2 { execsql { create table t3(a, b, c, unique(b,c) on conflict ignore); insert into t3 values(1,1,1); insert into t3 values(2,null,1); insert into t3 values(3,null,1); insert into t3 values(4,1,1); select a from t3; } } {1 2 3} # Ticket #461 - Make sure nulls are handled correctly when doing a # lookup using an index. # do_test null-8.1 { execsql { CREATE TABLE t4(x,y); INSERT INTO t4 VALUES(1,11); INSERT INTO t4 VALUES(2,NULL); SELECT x FROM t4 WHERE y=NULL; } } {} do_test null-8.2 { execsql { SELECT x FROM t4 WHERE y IN (33,NULL); } } {} do_test null-8.3 { execsql { SELECT x FROM t4 WHERE y<33 ORDER BY x; } } {1} do_test null-8.4 { execsql { SELECT x FROM t4 WHERE y>6 ORDER BY x; } } {1} do_test null-8.5 { execsql { SELECT x FROM t4 WHERE y!=33 ORDER BY x; } } {1} do_test null-8.11 { execsql { CREATE INDEX t4i1 ON t4(y); SELECT x FROM t4 WHERE y=NULL; } } {} do_test null-8.12 { execsql { SELECT x FROM t4 WHERE y IN (33,NULL); } } {} do_test null-8.13 { execsql { SELECT x FROM t4 WHERE y<33 ORDER BY x; } } {1} do_test null-8.14 { execsql { SELECT x FROM t4 WHERE y>6 ORDER BY x; } } {1} do_test null-8.15 { execsql { SELECT x FROM t4 WHERE y!=33 ORDER BY x; } } {1} finish_test sqlite-2.8.17/test/format3.test0000644000175000001440000004553410232547612016316 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the the library is able to correctly # handle file-format 3 (version 2.6.x) databases. # # $Id: format3.test,v 1.4 2003/12/23 02:17:35 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a bunch of data to sort against # do_test format3-1.0 { set fd [open data.txt w] puts $fd "1\tone\t0\tI\t3.141592653" puts $fd "2\ttwo\t1\tII\t2.15" puts $fd "3\tthree\t1\tIII\t4221.0" puts $fd "4\tfour\t2\tIV\t-0.0013442" puts $fd "5\tfive\t2\tV\t-11" puts $fd "6\tsix\t2\tVI\t0.123" puts $fd "7\tseven\t2\tVII\t123.0" puts $fd "8\teight\t3\tVIII\t-1.6" close $fd execsql { CREATE TABLE t1( n int, v varchar(10), log int, roman varchar(10), flt real ); COPY t1 FROM 'data.txt' } file delete data.txt db close set ::bt [btree_open test.db] btree_begin_transaction $::bt set m [btree_get_meta $::bt] set m [lreplace $m 2 2 3] eval btree_update_meta $::bt $m btree_commit $::bt btree_close $::bt sqlite db test.db execsql {SELECT count(*) FROM t1} } {8} do_test format3-1.1 { execsql {SELECT n FROM t1 ORDER BY n} } {1 2 3 4 5 6 7 8} do_test format3-1.1.1 { execsql {SELECT n FROM t1 ORDER BY n ASC} } {1 2 3 4 5 6 7 8} do_test format3-1.1.1 { execsql {SELECT ALL n FROM t1 ORDER BY n ASC} } {1 2 3 4 5 6 7 8} do_test format3-1.2 { execsql {SELECT n FROM t1 ORDER BY n DESC} } {8 7 6 5 4 3 2 1} do_test format3-1.3a { execsql {SELECT v FROM t1 ORDER BY v} } {eight five four one seven six three two} do_test format3-1.3b { execsql {SELECT n FROM t1 ORDER BY v} } {8 5 4 1 7 6 3 2} do_test format3-1.4 { execsql {SELECT n FROM t1 ORDER BY v DESC} } {2 3 6 7 1 4 5 8} do_test format3-1.5 { execsql {SELECT flt FROM t1 ORDER BY flt} } {-11 -1.6 -0.0013442 0.123 2.15 3.141592653 123.0 4221.0} do_test format3-1.6 { execsql {SELECT flt FROM t1 ORDER BY flt DESC} } {4221.0 123.0 3.141592653 2.15 0.123 -0.0013442 -1.6 -11} do_test format3-1.7 { execsql {SELECT roman FROM t1 ORDER BY roman} } {I II III IV V VI VII VIII} do_test format3-1.8 { execsql {SELECT n FROM t1 ORDER BY log, flt} } {1 2 3 5 4 6 7 8} do_test format3-1.8.1 { execsql {SELECT n FROM t1 ORDER BY log asc, flt} } {1 2 3 5 4 6 7 8} do_test format3-1.8.2 { execsql {SELECT n FROM t1 ORDER BY log, flt ASC} } {1 2 3 5 4 6 7 8} do_test format3-1.8.3 { execsql {SELECT n FROM t1 ORDER BY log ASC, flt asc} } {1 2 3 5 4 6 7 8} do_test format3-1.9 { execsql {SELECT n FROM t1 ORDER BY log, flt DESC} } {1 3 2 7 6 4 5 8} do_test format3-1.9.1 { execsql {SELECT n FROM t1 ORDER BY log ASC, flt DESC} } {1 3 2 7 6 4 5 8} do_test format3-1.10 { execsql {SELECT n FROM t1 ORDER BY log DESC, flt} } {8 5 4 6 7 2 3 1} do_test format3-1.11 { execsql {SELECT n FROM t1 ORDER BY log DESC, flt DESC} } {8 7 6 4 5 3 2 1} # These tests are designed to reach some hard-to-reach places # inside the string comparison routines. # # (Later) The sorting behavior changed in 2.7.0. But we will # keep these tests. You can never have too many test cases! # do_test format3-2.1.1 { execsql { UPDATE t1 SET v='x' || -flt; UPDATE t1 SET v='x-2b' where v=='x-0.123'; SELECT v FROM t1 ORDER BY v; } } {x-123 x-2.15 x-2b x-3.141592653 x-4221 x0.0013442 x1.6 x11} do_test format3-2.1.2 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999); } } {x-4221 x-123 x-3.141592653 x-2.15 x0.0013442 x1.6 x11 x-2b} do_test format3-2.1.3 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999)+0.0; } } {x-4221 x-123 x-3.141592653 x-2.15 x-2b x0.0013442 x1.6 x11} do_test format3-2.1.4 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999) DESC; } } {x-2b x11 x1.6 x0.0013442 x-2.15 x-3.141592653 x-123 x-4221} do_test format3-2.1.5 { execsql { SELECT v FROM t1 ORDER BY substr(v,2,999)+0.0 DESC; } } {x11 x1.6 x0.0013442 x-2b x-2.15 x-3.141592653 x-123 x-4221} # This is a bug fix for 2.2.4. # Strings are normally mapped to upper-case for a caseless comparison. # But this can cause problems for characters in between 'Z' and 'a'. # do_test format3-3.1 { execsql { CREATE TABLE t2(a,b); INSERT INTO t2 VALUES('AGLIENTU',1); INSERT INTO t2 VALUES('AGLIE`',2); INSERT INTO t2 VALUES('AGNA',3); SELECT a, b FROM t2 ORDER BY a; } } {AGLIENTU 1 AGLIE` 2 AGNA 3} do_test format3-3.2 { execsql { SELECT a, b FROM t2 ORDER BY a DESC; } } {AGNA 3 AGLIE` 2 AGLIENTU 1} do_test format3-3.3 { execsql { DELETE FROM t2; INSERT INTO t2 VALUES('aglientu',1); INSERT INTO t2 VALUES('aglie`',2); INSERT INTO t2 VALUES('agna',3); SELECT a, b FROM t2 ORDER BY a; } } {aglie` 2 aglientu 1 agna 3} do_test format3-3.4 { execsql { SELECT a, b FROM t2 ORDER BY a DESC; } } {agna 3 aglientu 1 aglie` 2} # Version 2.7.0 testing. # do_test format3-4.1 { execsql { INSERT INTO t1 VALUES(9,'x2.7',3,'IX',4.0e5); INSERT INTO t1 VALUES(10,'x5.0e10',3,'X',-4.0e5); INSERT INTO t1 VALUES(11,'x-4.0e9',3,'XI',4.1e4); INSERT INTO t1 VALUES(12,'x01234567890123456789',3,'XII',-4.2e3); SELECT n FROM t1 ORDER BY n; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test format3-4.2 { execsql { SELECT n||'' FROM t1 ORDER BY 1; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test format3-4.3 { execsql { SELECT n+0 FROM t1 ORDER BY 1; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test format3-4.4 { execsql { SELECT n||'' FROM t1 ORDER BY 1 DESC; } } {12 11 10 9 8 7 6 5 4 3 2 1} do_test format3-4.5 { execsql { SELECT n+0 FROM t1 ORDER BY 1 DESC; } } {12 11 10 9 8 7 6 5 4 3 2 1} do_test format3-4.6 { execsql { SELECT v FROM t1 ORDER BY 1; } } {x-123 x-2.15 x-2b x-3.141592653 x-4.0e9 x-4221 x0.0013442 x01234567890123456789 x1.6 x11 x2.7 x5.0e10} do_test format3-4.7 { execsql { SELECT v FROM t1 ORDER BY 1 DESC; } } {x5.0e10 x2.7 x11 x1.6 x01234567890123456789 x0.0013442 x-4221 x-4.0e9 x-3.141592653 x-2b x-2.15 x-123} do_test format3-4.8 { execsql { SELECT substr(v,2,99) FROM t1 ORDER BY 1; } } {-4.0e9 -4221 -123 -3.141592653 -2.15 0.0013442 1.6 2.7 11 5.0e10 01234567890123456789 -2b} # Build some new test data, this time with indices. # do_test format3-5.0 { execsql { DROP TABLE t1; CREATE TABLE t1(w int, x text, y blob); DROP TABLE t2; CREATE TABLE t2(p varchar(1), q clob, r real, s numeric(8)); } for {set i 1} {$i<=100} {incr i} { set w $i set x [expr {int(log($i)/log(2))}] set y [expr {$i*$i + 2*$i + 1}] execsql "INSERT INTO t1 VALUES($w,$x,$y)" } execsql { INSERT INTO t2 SELECT 101-w, x, (SELECT max(y) FROM t1)+1-y, y FROM t1; CREATE INDEX i1w ON t1(w); CREATE INDEX i1xy ON t1(x,y); CREATE INDEX i2p ON t2(p); CREATE INDEX i2r ON t2(r); CREATE INDEX i2qs ON t2(q, s); } } {} # Do an SQL statement. Append the search count to the end of the result. # proc count sql { set ::sqlite_search_count 0 return [concat [execsql $sql] $::sqlite_search_count] } # Verify that queries use an index. We are using the special variable # "sqlite_search_count" which tallys the number of executions of MoveTo # and Next operators in the VDBE. By verifing that the search count is # small we can be assured that indices are being used properly. # do_test format3-5.1 { db close sqlite db test.db count {SELECT x, y FROM t1 WHERE w=10} } {3 121 3} do_test format3-5.2 { count {SELECT x, y FROM t1 WHERE w=11} } {3 144 3} do_test format3-5.3 { count {SELECT x, y FROM t1 WHERE 11=w} } {3 144 3} do_test format3-5.4 { count {SELECT x, y FROM t1 WHERE 11=w AND x>2} } {3 144 3} do_test format3-5.5 { count {SELECT x, y FROM t1 WHERE y<200 AND w=11 AND x>2} } {3 144 3} do_test format3-5.6 { count {SELECT x, y FROM t1 WHERE y<200 AND x>2 AND w=11} } {3 144 3} do_test format3-5.7 { count {SELECT x, y FROM t1 WHERE w=11 AND y<200 AND x>2} } {3 144 3} do_test format3-5.8 { count {SELECT x, y FROM t1 WHERE w>10 AND y=144 AND x=3} } {3 144 3} do_test format3-5.9 { count {SELECT x, y FROM t1 WHERE y=144 AND w>10 AND x=3} } {3 144 3} do_test format3-5.10 { count {SELECT x, y FROM t1 WHERE x=3 AND w>=10 AND y=121} } {3 121 3} do_test format3-5.11 { count {SELECT x, y FROM t1 WHERE x=3 AND y=100 AND w<10} } {3 100 3} # New for SQLite version 2.1: Verify that that inequality constraints # are used correctly. # do_test format3-5.12 { count {SELECT w FROM t1 WHERE x=3 AND y<100} } {8 3} do_test format3-5.13 { count {SELECT w FROM t1 WHERE x=3 AND 100>y} } {8 3} do_test format3-5.14 { count {SELECT w FROM t1 WHERE 3=x AND y<100} } {8 3} do_test format3-5.15 { count {SELECT w FROM t1 WHERE 3=x AND 100>y} } {8 3} do_test format3-5.16 { count {SELECT w FROM t1 WHERE x=3 AND y<=100} } {8 9 5} do_test format3-5.17 { count {SELECT w FROM t1 WHERE x=3 AND 100>=y} } {8 9 5} do_test format3-5.18 { count {SELECT w FROM t1 WHERE x=3 AND y>225} } {15 3} do_test format3-5.19 { count {SELECT w FROM t1 WHERE x=3 AND 225=225} } {14 15 5} do_test format3-5.21 { count {SELECT w FROM t1 WHERE x=3 AND 225<=y} } {14 15 5} do_test format3-5.22 { count {SELECT w FROM t1 WHERE x=3 AND y>121 AND y<196} } {11 12 5} do_test format3-5.23 { count {SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<=196} } {10 11 12 13 9} do_test format3-5.24 { count {SELECT w FROM t1 WHERE x=3 AND 121y} } {11 12 5} do_test format3-5.25 { count {SELECT w FROM t1 WHERE x=3 AND 121<=y AND 196>=y} } {10 11 12 13 9} # Need to work on optimizing the BETWEEN operator. # # do_test format3-5.26 { # count {SELECT w FROM t1 WHERE x=3 AND y BETWEEN 121 AND 196} # } {10 11 12 13 9} do_test format3-5.27 { count {SELECT w FROM t1 WHERE x=3 AND y+1==122} } {10 17} do_test format3-5.28 { count {SELECT w FROM t1 WHERE x+1=4 AND y+1==122} } {10 99} do_test format3-5.29 { count {SELECT w FROM t1 WHERE y==121} } {10 99} do_test format3-5.30 { count {SELECT w FROM t1 WHERE w>97} } {98 99 100 6} do_test format3-5.31 { count {SELECT w FROM t1 WHERE w>=97} } {97 98 99 100 8} do_test format3-5.33 { count {SELECT w FROM t1 WHERE w==97} } {97 3} do_test format3-5.34 { count {SELECT w FROM t1 WHERE w+1==98} } {97 99} do_test format3-5.35 { count {SELECT w FROM t1 WHERE w<3} } {1 2 4} do_test format3-5.36 { count {SELECT w FROM t1 WHERE w<=3} } {1 2 3 6} do_test format3-5.37 { count {SELECT w FROM t1 WHERE w+1<=4 ORDER BY w} } {1 2 3 199} # Do the same kind of thing except use a join as the data source. # do_test format3-6.1 { db close sqlite db test.db count { SELECT w, p FROM t2, t1 WHERE x=q AND y=s AND r=8977 } } {34 67 6} do_test format3-6.2 { count { SELECT w, p FROM t2, t1 WHERE x=q AND s=y AND r=8977 } } {34 67 6} do_test format3-6.3 { count { SELECT w, p FROM t2, t1 WHERE x=q AND s=y AND r=8977 AND w>10 } } {34 67 6} do_test format3-6.4 { count { SELECT w, p FROM t2, t1 WHERE p<80 AND x=q AND s=y AND r=8977 AND w>10 } } {34 67 6} do_test format3-6.5 { count { SELECT w, p FROM t2, t1 WHERE p<80 AND x=q AND 8977=r AND s=y AND w>10 } } {34 67 6} do_test format3-6.6 { count { SELECT w, p FROM t2, t1 WHERE x=q AND p=77 AND s=y AND w>5 } } {24 77 6} do_test format3-6.7 { count { SELECT w, p FROM t1, t2 WHERE x=q AND p>77 AND s=y AND w=5 } } {5 96 6} # Lets do a 3-way join. # do_test format3-7.1 { count { SELECT A.w, B.p, C.w FROM t1 as A, t2 as B, t1 as C WHERE C.w=101-B.p AND B.r=10202-A.y AND A.w=11 } } {11 90 11 9} do_test format3-7.2 { count { SELECT A.w, B.p, C.w FROM t1 as A, t2 as B, t1 as C WHERE C.w=101-B.p AND B.r=10202-A.y AND A.w=12 } } {12 89 12 9} do_test format3-7.3 { count { SELECT A.w, B.p, C.w FROM t1 as A, t2 as B, t1 as C WHERE A.w=15 AND B.p=C.w AND B.r=10202-A.y } } {15 86 86 9} # Test to see that the special case of a constant WHERE clause is # handled. # do_test format3-8.1 { count { SELECT * FROM t1 WHERE 0 } } {0} do_test format3-8.2 { count { SELECT * FROM t1 WHERE 1 LIMIT 1 } } {1 0 4 1} do_test format3-8.3 { execsql { SELECT 99 WHERE 0 } } {} do_test format3-8.4 { execsql { SELECT 99 WHERE 1 } } {99} # Verify that IN operators in a WHERE clause are handled correctly. # do_test format3-9.1 { count { SELECT * FROM t1 WHERE rowid IN (1,2,3,1234) order by 1; } } {1 0 4 2 1 9 3 1 16 0} do_test format3-9.2 { count { SELECT * FROM t1 WHERE rowid+0 IN (1,2,3,1234) order by 1; } } {1 0 4 2 1 9 3 1 16 199} do_test format3-9.3 { count { SELECT * FROM t1 WHERE w IN (-1,1,2,3) order by 1; } } {1 0 4 2 1 9 3 1 16 10} do_test format3-9.4 { count { SELECT * FROM t1 WHERE w+0 IN (-1,1,2,3) order by 1; } } {1 0 4 2 1 9 3 1 16 199} do_test format3-9.5 { count { SELECT * FROM t1 WHERE rowid IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 1} do_test format3-9.6 { count { SELECT * FROM t1 WHERE rowid+0 IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 199} do_test format3-9.7 { count { SELECT * FROM t1 WHERE w IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 7} do_test format3-9.8 { count { SELECT * FROM t1 WHERE w+0 IN (select rowid from t1 where rowid IN (-1,2,4)) ORDER BY 1; } } {2 1 9 4 2 25 199} do_test format3-9.9 { count { SELECT * FROM t1 WHERE x IN (1,7) ORDER BY 1; } } {2 1 9 3 1 16 6} do_test format3-9.10 { count { SELECT * FROM t1 WHERE x+0 IN (1,7) ORDER BY 1; } } {2 1 9 3 1 16 199} do_test format3-9.11 { count { SELECT * FROM t1 WHERE y IN (6400,8100) ORDER BY 1; } } {79 6 6400 89 6 8100 199} do_test format3-9.12 { count { SELECT * FROM t1 WHERE x=6 AND y IN (6400,8100) ORDER BY 1; } } {79 6 6400 89 6 8100 74} do_test format3-9.13 { count { SELECT * FROM t1 WHERE x IN (1,7) AND y NOT IN (6400,8100) ORDER BY 1; } } {2 1 9 3 1 16 6} do_test format3-9.14 { count { SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,10) ORDER BY 1; } } {2 1 9 6} # This procedure executes the SQL. Then it checks the generated program # for the SQL and appends a "nosort" to the result if the program contains the # SortCallback opcode. If the program does not contain the SortCallback # opcode it appends "sort" # proc cksort {sql} { set data [execsql $sql] set prog [execsql "EXPLAIN $sql"] if {[regexp SortCallback $prog]} {set x sort} {set x nosort} lappend data $x return $data } # Check out the logic that attempts to implement the ORDER BY clause # using an index rather than by sorting. # do_test format3-10.1 { execsql { CREATE TABLE t3(a,b,c); CREATE INDEX t3a ON t3(a); CREATE INDEX t3bc ON t3(b,c); CREATE INDEX t3acb ON t3(a,c,b); INSERT INTO t3 SELECT w, 101-w, y FROM t1; SELECT count(*), sum(a), sum(b), sum(c) FROM t3; } } {100 5050 5050 348550} do_test format3-10.2 { cksort { SELECT * FROM t3 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test format3-10.3 { cksort { SELECT * FROM t3 ORDER BY a+1 LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort} do_test format3-10.4 { cksort { SELECT * FROM t3 WHERE a<10 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test format3-10.5 { cksort { SELECT * FROM t3 WHERE a>0 AND a<10 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test format3-10.6 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} do_test format3-10.7 { cksort { SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort} do_test format3-10.8 { cksort { SELECT * FROM t3 WHERE a IN (3,5,7,1,9,4,2) ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort} do_test format3-10.9 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a LIMIT 3 } } {1 100 4 nosort} do_test format3-10.10 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a LIMIT 3 } } {1 100 4 nosort} do_test format3-10.11 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c LIMIT 3 } } {1 100 4 nosort} do_test format3-10.12 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c,b LIMIT 3 } } {1 100 4 nosort} do_test format3-10.13 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a DESC LIMIT 3 } } {100 1 10201 99 2 10000 98 3 9801 nosort} do_test format3-10.13.1 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a+1 DESC LIMIT 3 } } {100 1 10201 99 2 10000 98 3 9801 sort} do_test format3-10.14 { cksort { SELECT * FROM t3 ORDER BY b LIMIT 3 } } {100 1 10201 99 2 10000 98 3 9801 nosort} do_test format3-10.15 { cksort { SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t3.a LIMIT 3 } } {1 0 2 1 3 1 nosort} do_test format3-10.16 { cksort { SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t1.x, t3.a LIMIT 3 } } {1 0 2 1 3 1 sort} do_test format3-10.17 { cksort { SELECT y FROM t1 ORDER BY w COLLATE text LIMIT 3; } } {4 121 10201 sort} do_test format3-10.18 { cksort { SELECT y FROM t1 ORDER BY w COLLATE numeric LIMIT 3; } } {4 9 16 sort} do_test format3-10.19 { cksort { SELECT y FROM t1 ORDER BY w LIMIT 3; } } {4 9 16 nosort} # Check that all comparisons are numeric. Similar tests in misc1.test # check the same comparisons on a format4+ database and find that some # are numeric and some are text. # do_test format3-11.1 { execsql {SELECT '0'=='0.0'} } {1} do_test format3-11.2 { execsql {SELECT '0'==0.0} } {1} do_test format3-11.3 { execsql {SELECT '123456789012345678901'=='123456789012345678900'} } {1} do_test format3-11.4 { execsql { CREATE TABLE t6(a INT UNIQUE, b TEXT UNIQUE); INSERT INTO t6 VALUES('0','0.0'); SELECT * FROM t6; } } {0 0.0} do_test format3-11.5 { execsql { INSERT OR IGNORE INTO t6 VALUES(0.0,'x'); SELECT * FROM t6; } } {0 0.0} do_test format3-11.6 { execsql { INSERT OR IGNORE INTO t6 VALUES('y',0); SELECT * FROM t6; } } {0 0.0} do_test format3-11.7 { execsql { CREATE TABLE t7(x INTEGER, y TEXT, z); INSERT INTO t7 VALUES(0,0,1); INSERT INTO t7 VALUES(0.0,0,2); INSERT INTO t7 VALUES(0,0.0,3); INSERT INTO t7 VALUES(0.0,0.0,4); SELECT DISTINCT x, y FROM t7 ORDER BY z; } } {0 0} # Make sure attempts to attach a format 3 database fail. # do_test format3-12.1 { file delete -force test2.db sqlite db2 test2.db catchsql { CREATE TABLE t8(x,y); ATTACH DATABASE 'test.db' AS format3; } db2; } {1 {incompatible file format in auxiliary database: format3}} do_test format3-12.2 { catchsql { ATTACH DATABASE 'test2.db' AS test2; } } {1 {cannot attach auxiliary databases to an older format master database}} db2 close finish_test sqlite-2.8.17/test/tableapi.test0000644000175000001440000001764210232547612016523 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the sqlite_exec_printf() and # sqlite_get_table_printf() APIs. # # $Id: tableapi.test,v 1.7 2004/02/02 12:29:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test tableapi-1.0 { set ::dbx [sqlite_open test.db] catch {sqlite_exec_printf $::dbx {DROP TABLE xyz} {}} sqlite_exec_printf $::dbx {CREATE TABLE %s(a int, b text)} xyz } {0 {}} do_test tableapi-1.1 { sqlite_exec_printf $::dbx { INSERT INTO xyz VALUES(1,'%q') } {Hi Y'all} } {0 {}} do_test tableapi-1.2 { sqlite_exec_printf $::dbx {SELECT * FROM xyz} {} } {0 {a b 1 {Hi Y'all}}} do_test tableapi-2.1 { sqlite_get_table_printf $::dbx { BEGIN TRANSACTION; SELECT * FROM xyz WHERE b='%q' } {Hi Y'all} } {0 1 2 a b 1 {Hi Y'all}} do_test tableapi-2.2 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz } {} } {0 1 2 a b 1 {Hi Y'all}} do_test tableapi-2.3 { for {set i 2} {$i<=50} {incr i} { sqlite_get_table_printf $::dbx \ "INSERT INTO xyz VALUES($i,'(%s)')" $i } sqlite_get_table_printf $::dbx { SELECT * FROM xyz ORDER BY a } {} } {0 50 2 a b 1 {Hi Y'all} 2 (2) 3 (3) 4 (4) 5 (5) 6 (6) 7 (7) 8 (8) 9 (9) 10 (10) 11 (11) 12 (12) 13 (13) 14 (14) 15 (15) 16 (16) 17 (17) 18 (18) 19 (19) 20 (20) 21 (21) 22 (22) 23 (23) 24 (24) 25 (25) 26 (26) 27 (27) 28 (28) 29 (29) 30 (30) 31 (31) 32 (32) 33 (33) 34 (34) 35 (35) 36 (36) 37 (37) 38 (38) 39 (39) 40 (40) 41 (41) 42 (42) 43 (43) 44 (44) 45 (45) 46 (46) 47 (47) 48 (48) 49 (49) 50 (50)} do_test tableapi-2.3.1 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>49 ORDER BY a } {} } {0 1 2 a b 50 (50)} do_test tableapi-2.3.2 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>47 ORDER BY a } {} } {0 3 2 a b 48 (48) 49 (49) 50 (50)} do_test tableapi-2.4 { set manyquote '''''''' append manyquote $manyquote append manyquote $manyquote append manyquote $manyquote append manyquote $manyquote append manyquote $manyquote append manyquote $manyquote set ::big_str "$manyquote Hello $manyquote" sqlite_get_table_printf $::dbx { INSERT INTO xyz VALUES(51,'%q') } $::big_str } {0 0 0} do_test tableapi-2.5 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>49 ORDER BY a; } {} } "0 2 2 a b 50 (50) 51 \173$::big_str\175" do_test tableapi-2.6 { sqlite_get_table_printf $::dbx { INSERT INTO xyz VALUES(52,NULL) } {} sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a IN (42,50,52) ORDER BY a DESC } {} } {0 3 2 a b 52 NULL 50 (50) 42 (42)} do_test tableapi-2.7 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>1000 } {} } {0 0 0} # Repeat all tests with the empty_result_callbacks pragma turned on # do_test tableapi-3.1 { sqlite_get_table_printf $::dbx { ROLLBACK; PRAGMA empty_result_callbacks = ON; SELECT * FROM xyz WHERE b='%q' } {Hi Y'all} } {0 1 2 a b 1 {Hi Y'all}} do_test tableapi-3.2 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz } {} } {0 1 2 a b 1 {Hi Y'all}} do_test tableapi-3.3 { for {set i 2} {$i<=50} {incr i} { sqlite_get_table_printf $::dbx \ "INSERT INTO xyz VALUES($i,'(%s)')" $i } sqlite_get_table_printf $::dbx { SELECT * FROM xyz ORDER BY a } {} } {0 50 2 a b 1 {Hi Y'all} 2 (2) 3 (3) 4 (4) 5 (5) 6 (6) 7 (7) 8 (8) 9 (9) 10 (10) 11 (11) 12 (12) 13 (13) 14 (14) 15 (15) 16 (16) 17 (17) 18 (18) 19 (19) 20 (20) 21 (21) 22 (22) 23 (23) 24 (24) 25 (25) 26 (26) 27 (27) 28 (28) 29 (29) 30 (30) 31 (31) 32 (32) 33 (33) 34 (34) 35 (35) 36 (36) 37 (37) 38 (38) 39 (39) 40 (40) 41 (41) 42 (42) 43 (43) 44 (44) 45 (45) 46 (46) 47 (47) 48 (48) 49 (49) 50 (50)} do_test tableapi-3.3.1 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>49 ORDER BY a } {} } {0 1 2 a b 50 (50)} do_test tableapi-3.3.2 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>47 ORDER BY a } {} } {0 3 2 a b 48 (48) 49 (49) 50 (50)} do_test tableapi-3.4 { sqlite_get_table_printf $::dbx { INSERT INTO xyz VALUES(51,'%q') } $::big_str } {0 0 0} do_test tableapi-3.5 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>49 ORDER BY a; } {} } "0 2 2 a b 50 (50) 51 \173$::big_str\175" do_test tableapi-3.6 { sqlite_get_table_printf $::dbx { INSERT INTO xyz VALUES(52,NULL) } {} sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a IN (42,50,52) ORDER BY a DESC } {} } {0 3 2 a b 52 NULL 50 (50) 42 (42)} do_test tableapi-3.7 { sqlite_get_table_printf $::dbx { SELECT * FROM xyz WHERE a>1000 } {} } {0 0 2 a b} do_test tableapi-4.1 { set rc [catch { sqlite_get_table_printf $::dbx { SELECT * FROM xyz; SELECT * FROM sqlite_master } {} } msg] concat $rc $msg } {0 1 {sqlite_get_table() called with two or more incompatible queries}} # A report on the mailing list says that the sqlite_get_table() api fails # on queries involving more than 40 columns. The following code attempts # to test that complaint # do_test tableapi-5.1 { set sql "CREATE TABLE t2(" set sep "" for {set i 1} {$i<=100} {incr i} { append sql ${sep}x$i set sep , } append sql ) sqlite_get_table_printf $::dbx $sql {} set sql "INSERT INTO t2 VALUES(" set sep "" for {set i 1} {$i<=100} {incr i} { append sql ${sep}$i set sep , } append sql ) sqlite_get_table_printf $::dbx $sql {} sqlite_get_table_printf $::dbx {SELECT * FROM t2} {} } {0 1 100 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 x60 x61 x62 x63 x64 x65 x66 x67 x68 x69 x70 x71 x72 x73 x74 x75 x76 x77 x78 x79 x80 x81 x82 x83 x84 x85 x86 x87 x88 x89 x90 x91 x92 x93 x94 x95 x96 x97 x98 x99 x100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100} do_test tableapi-5.2 { set sql "INSERT INTO t2 VALUES(" set sep "" for {set i 1} {$i<=100} {incr i} { append sql ${sep}[expr {$i+1000}] set sep , } append sql ) sqlite_get_table_printf $::dbx $sql {} sqlite_get_table_printf $::dbx {SELECT * FROM t2} {} } {0 2 100 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 x60 x61 x62 x63 x64 x65 x66 x67 x68 x69 x70 x71 x72 x73 x74 x75 x76 x77 x78 x79 x80 x81 x82 x83 x84 x85 x86 x87 x88 x89 x90 x91 x92 x93 x94 x95 x96 x97 x98 x99 x100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100} do_test tableapi-99.0 { sqlite_close $::dbx } {} finish_test sqlite-2.8.17/test/misuse.test0000644000175000001440000001017410232547612016240 0ustar drhusers00000000000000# 2002 May 10 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the SQLITE_MISUSE detection logic. # This test file leaks memory and file descriptors. # # $Id: misuse.test,v 1.4 2004/01/07 19:24:48 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Make sure the test logic works # do_test misuse-1.1 { db close catch {file delete -force test2.db} set ::DB [sqlite db test2.db] execsql { CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); } sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {0 {a b 1 2}} do_test misuse-1.2 { sqlite_exec_printf $::DB {SELECT x_coalesce(NULL,a) AS 'xyz' FROM t1} {} } {1 {no such function: x_coalesce}} do_test misuse-1.3 { sqlite_create_function $::DB sqlite_exec_printf $::DB {SELECT x_coalesce(NULL,a) AS 'xyz' FROM t1} {} } {0 {xyz 1}} # Use the x_sqlite_exec() SQL function to simulate the effect of two # threads trying to use the same database at the same time. # # It used to be prohibited to invoke sqlite_exec() from within a function, # but that has changed. The following tests used to cause errors but now # they do not. # do_test misuse-1.4 { sqlite_exec_printf $::DB { SELECT x_sqlite_exec('SELECT * FROM t1') AS xyz; } {} } {0 {xyz {1 2}}} do_test misuse-1.5 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {0 {a b 1 2}} do_test misuse-1.6 { catchsql { SELECT * FROM t1 } } {0 {1 2}} # Attempt to register a new SQL function while an sqlite_exec() is active. # do_test misuse-2.1 { db close set ::DB [sqlite db test2.db] execsql { SELECT * FROM t1 } } {1 2} do_test misuse-2.2 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {0 {a b 1 2}} do_test misuse-2.3 { set v [catch { db eval {SELECT * FROM t1} {} { sqlite_create_function $::DB } } msg] lappend v $msg } {1 {library routine called out of sequence}} do_test misuse-2.4 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {21 {library routine called out of sequence}} do_test misuse-2.5 { catchsql { SELECT * FROM t1 } } {1 {library routine called out of sequence}} # Attempt to register a new SQL aggregate while an sqlite_exec() is active. # do_test misuse-3.1 { db close set ::DB [sqlite db test2.db] execsql { SELECT * FROM t1 } } {1 2} do_test misuse-3.2 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {0 {a b 1 2}} do_test misuse-3.3 { set v [catch { db eval {SELECT * FROM t1} {} { sqlite_create_aggregate $::DB } } msg] lappend v $msg } {1 {library routine called out of sequence}} do_test misuse-3.4 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {21 {library routine called out of sequence}} do_test misuse-3.5 { catchsql { SELECT * FROM t1 } } {1 {library routine called out of sequence}} # Attempt to close the database from an sqlite_exec callback. # do_test misuse-4.1 { db close set ::DB [sqlite db test2.db] execsql { SELECT * FROM t1 } } {1 2} do_test misuse-4.2 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {0 {a b 1 2}} do_test misuse-4.3 { set v [catch { db eval {SELECT * FROM t1} {} { sqlite_close $::DB } } msg] lappend v $msg } {1 {library routine called out of sequence}} do_test misuse-4.4 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {21 {library routine called out of sequence}} do_test misuse-4.5 { catchsql { SELECT * FROM t1 } } {1 {library routine called out of sequence}} # Attempt to use a database after it has been closed. # do_test misuse-5.1 { db close set ::DB [sqlite db test2.db] execsql { SELECT * FROM t1 } } {1 2} do_test misuse-5.2 { sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {0 {a b 1 2}} do_test misuse-5.3 { db close sqlite_exec_printf $::DB {SELECT * FROM t1} {} } {21 {library routine called out of sequence}} finish_test sqlite-2.8.17/test/update.test0000644000175000001440000004141310232547612016215 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the UPDATE statement. # # $Id: update.test,v 1.15 2004/02/10 13:41:53 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to update an non-existent table # do_test update-1.1 { set v [catch {execsql {UPDATE test1 SET f2=5 WHERE f1<1}} msg] lappend v $msg } {1 {no such table: test1}} # Try to update a read-only table # do_test update-2.1 { set v [catch \ {execsql {UPDATE sqlite_master SET name='xyz' WHERE name='123'}} msg] lappend v $msg } {1 {table sqlite_master may not be modified}} # Create a table to work with # do_test update-3.1 { execsql {CREATE TABLE test1(f1 int,f2 int)} for {set i 1} {$i<=10} {incr i} { set sql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])" execsql $sql } execsql {SELECT * FROM test1 ORDER BY f1} } {1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024} # Unknown column name in an expression # do_test update-3.2 { set v [catch {execsql {UPDATE test1 SET f1=f3*2 WHERE f2==32}} msg] lappend v $msg } {1 {no such column: f3}} do_test update-3.3 { set v [catch {execsql {UPDATE test1 SET f1=test2.f1*2 WHERE f2==32}} msg] lappend v $msg } {1 {no such column: test2.f1}} do_test update-3.4 { set v [catch {execsql {UPDATE test1 SET f3=f1*2 WHERE f2==32}} msg] lappend v $msg } {1 {no such column: f3}} # Actually do some updates # do_test update-3.5 { execsql {UPDATE test1 SET f2=f2*3} } {} do_test update-3.6 { execsql {SELECT * FROM test1 ORDER BY f1} } {1 6 2 12 3 24 4 48 5 96 6 192 7 384 8 768 9 1536 10 3072} do_test update-3.7 { execsql {PRAGMA count_changes=on} execsql {UPDATE test1 SET f2=f2/3 WHERE f1<=5} } {5} do_test update-3.8 { execsql {SELECT * FROM test1 ORDER BY f1} } {1 2 2 4 3 8 4 16 5 32 6 192 7 384 8 768 9 1536 10 3072} do_test update-3.9 { execsql {UPDATE test1 SET f2=f2/3 WHERE f1>5} } {5} do_test update-3.10 { execsql {SELECT * FROM test1 ORDER BY f1} } {1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024} # Swap the values of f1 and f2 for all elements # do_test update-3.11 { execsql {UPDATE test1 SET F2=f1, F1=f2} } {10} do_test update-3.12 { execsql {SELECT * FROM test1 ORDER BY F1} } {2 1 4 2 8 3 16 4 32 5 64 6 128 7 256 8 512 9 1024 10} do_test update-3.13 { execsql {PRAGMA count_changes=off} execsql {UPDATE test1 SET F2=f1, F1=f2} } {} do_test update-3.14 { execsql {SELECT * FROM test1 ORDER BY F1} } {1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024} # Create duplicate entries and make sure updating still # works. # do_test update-4.0 { execsql { DELETE FROM test1 WHERE f1<=5; INSERT INTO test1(f1,f2) VALUES(8,88); INSERT INTO test1(f1,f2) VALUES(8,888); INSERT INTO test1(f1,f2) VALUES(77,128); INSERT INTO test1(f1,f2) VALUES(777,128); } execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-4.1 { execsql {UPDATE test1 SET f2=f2+1 WHERE f1==8} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 889 9 512 10 1024 77 128 777 128} do_test update-4.2 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2>800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 888 9 512 10 1024 77 128 777 128} do_test update-4.3 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2<800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-4.4 { execsql {UPDATE test1 SET f1=f1+1 WHERE f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 778 128} do_test update-4.5 { execsql {UPDATE test1 SET f1=f1-1 WHERE f1>100 and f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 777 128} do_test update-4.6 { execsql { PRAGMA count_changes=on; UPDATE test1 SET f1=f1-1 WHERE f1<=100 and f2==128; } } {2} do_test update-4.7 { execsql { PRAGMA count_changes=off; SELECT * FROM test1 ORDER BY f1,f2 } } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} # Repeat the previous sequence of tests with an index. # do_test update-5.0 { execsql {CREATE INDEX idx1 ON test1(f1)} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-5.1 { execsql {UPDATE test1 SET f2=f2+1 WHERE f1==8} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 889 9 512 10 1024 77 128 777 128} do_test update-5.2 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2>800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 888 9 512 10 1024 77 128 777 128} do_test update-5.3 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2<800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-5.4 { execsql {UPDATE test1 SET f1=f1+1 WHERE f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 778 128} do_test update-5.4.1 { execsql {SELECT * FROM test1 WHERE f1==78 ORDER BY f1,f2} } {78 128} do_test update-5.4.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {778 128} do_test update-5.4.3 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 128 8 256 8 888} do_test update-5.5 { execsql {UPDATE test1 SET f1=f1-1 WHERE f1>100 and f2==128} } {} do_test update-5.5.1 { execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 777 128} do_test update-5.5.2 { execsql {SELECT * FROM test1 WHERE f1==78 ORDER BY f1,f2} } {78 128} do_test update-5.5.3 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {} do_test update-5.5.4 { execsql {SELECT * FROM test1 WHERE f1==777 ORDER BY f1,f2} } {777 128} do_test update-5.5.5 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 128 8 256 8 888} do_test update-5.6 { execsql { PRAGMA count_changes=on; UPDATE test1 SET f1=f1-1 WHERE f1<=100 and f2==128; } } {2} do_test update-5.6.1 { execsql { PRAGMA count_changes=off; SELECT * FROM test1 ORDER BY f1,f2 } } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-5.6.2 { execsql {SELECT * FROM test1 WHERE f1==77 ORDER BY f1,f2} } {77 128} do_test update-5.6.3 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {} do_test update-5.6.4 { execsql {SELECT * FROM test1 WHERE f1==777 ORDER BY f1,f2} } {777 128} do_test update-5.6.5 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 256 8 888} # Repeat the previous sequence of tests with a different index. # execsql {PRAGMA synchronous=FULL} do_test update-6.0 { execsql {DROP INDEX idx1} execsql {CREATE INDEX idx1 ON test1(f2)} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-6.1 { execsql {UPDATE test1 SET f2=f2+1 WHERE f1==8} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 889 9 512 10 1024 77 128 777 128} do_test update-6.1.1 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 89 8 257 8 889} do_test update-6.1.2 { execsql {SELECT * FROM test1 WHERE f2==89 ORDER BY f1,f2} } {8 89} do_test update-6.1.3 { execsql {SELECT * FROM test1 WHERE f1==88 ORDER BY f1,f2} } {} do_test update-6.2 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2>800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 888 9 512 10 1024 77 128 777 128} do_test update-6.3 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2<800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-6.3.1 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 256 8 888} do_test update-6.3.2 { execsql {SELECT * FROM test1 WHERE f2==89 ORDER BY f1,f2} } {} do_test update-6.3.3 { execsql {SELECT * FROM test1 WHERE f2==88 ORDER BY f1,f2} } {8 88} do_test update-6.4 { execsql {UPDATE test1 SET f1=f1+1 WHERE f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 778 128} do_test update-6.4.1 { execsql {SELECT * FROM test1 WHERE f1==78 ORDER BY f1,f2} } {78 128} do_test update-6.4.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {778 128} do_test update-6.4.3 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 128 8 256 8 888} do_test update-6.5 { execsql {UPDATE test1 SET f1=f1-1 WHERE f1>100 and f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 777 128} do_test update-6.5.1 { execsql {SELECT * FROM test1 WHERE f1==78 ORDER BY f1,f2} } {78 128} do_test update-6.5.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {} do_test update-6.5.3 { execsql {SELECT * FROM test1 WHERE f1==777 ORDER BY f1,f2} } {777 128} do_test update-6.5.4 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 128 8 256 8 888} do_test update-6.6 { execsql {UPDATE test1 SET f1=f1-1 WHERE f1<=100 and f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-6.6.1 { execsql {SELECT * FROM test1 WHERE f1==77 ORDER BY f1,f2} } {77 128} do_test update-6.6.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {} do_test update-6.6.3 { execsql {SELECT * FROM test1 WHERE f1==777 ORDER BY f1,f2} } {777 128} do_test update-6.6.4 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 256 8 888} # Repeat the previous sequence of tests with multiple # indices # do_test update-7.0 { execsql {CREATE INDEX idx2 ON test1(f2)} execsql {CREATE INDEX idx3 ON test1(f1,f2)} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-7.1 { execsql {UPDATE test1 SET f2=f2+1 WHERE f1==8} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 889 9 512 10 1024 77 128 777 128} do_test update-7.1.1 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 89 8 257 8 889} do_test update-7.1.2 { execsql {SELECT * FROM test1 WHERE f2==89 ORDER BY f1,f2} } {8 89} do_test update-7.1.3 { execsql {SELECT * FROM test1 WHERE f1==88 ORDER BY f1,f2} } {} do_test update-7.2 { execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2>800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 89 8 257 8 888 9 512 10 1024 77 128 777 128} do_test update-7.3 { # explain {UPDATE test1 SET f2=f2-1 WHERE f1==8 and F2<300} execsql {UPDATE test1 SET f2=f2-1 WHERE f1==8 and f2<800} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-7.3.1 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 256 8 888} do_test update-7.3.2 { execsql {SELECT * FROM test1 WHERE f2==89 ORDER BY f1,f2} } {} do_test update-7.3.3 { execsql {SELECT * FROM test1 WHERE f2==88 ORDER BY f1,f2} } {8 88} do_test update-7.4 { execsql {UPDATE test1 SET f1=f1+1 WHERE f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 778 128} do_test update-7.4.1 { execsql {SELECT * FROM test1 WHERE f1==78 ORDER BY f1,f2} } {78 128} do_test update-7.4.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {778 128} do_test update-7.4.3 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 128 8 256 8 888} do_test update-7.5 { execsql {UPDATE test1 SET f1=f1-1 WHERE f1>100 and f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 8 88 8 128 8 256 8 888 9 512 10 1024 78 128 777 128} do_test update-7.5.1 { execsql {SELECT * FROM test1 WHERE f1==78 ORDER BY f1,f2} } {78 128} do_test update-7.5.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {} do_test update-7.5.3 { execsql {SELECT * FROM test1 WHERE f1==777 ORDER BY f1,f2} } {777 128} do_test update-7.5.4 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 128 8 256 8 888} do_test update-7.6 { execsql {UPDATE test1 SET f1=f1-1 WHERE f1<=100 and f2==128} execsql {SELECT * FROM test1 ORDER BY f1,f2} } {6 64 7 128 8 88 8 256 8 888 9 512 10 1024 77 128 777 128} do_test update-7.6.1 { execsql {SELECT * FROM test1 WHERE f1==77 ORDER BY f1,f2} } {77 128} do_test update-7.6.2 { execsql {SELECT * FROM test1 WHERE f1==778 ORDER BY f1,f2} } {} do_test update-7.6.3 { execsql {SELECT * FROM test1 WHERE f1==777 ORDER BY f1,f2} } {777 128} do_test update-7.6.4 { execsql {SELECT * FROM test1 WHERE f1==8 ORDER BY f1,f2} } {8 88 8 256 8 888} # Error messages # do_test update-9.1 { set v [catch {execsql { UPDATE test1 SET x=11 WHERE f1=1025 }} msg] lappend v $msg } {1 {no such column: x}} do_test update-9.2 { set v [catch {execsql { UPDATE test1 SET f1=x(11) WHERE f1=1025 }} msg] lappend v $msg } {1 {no such function: x}} do_test update-9.3 { set v [catch {execsql { UPDATE test1 SET f1=11 WHERE x=1025 }} msg] lappend v $msg } {1 {no such column: x}} do_test update-9.4 { set v [catch {execsql { UPDATE test1 SET f1=11 WHERE x(f1)=1025 }} msg] lappend v $msg } {1 {no such function: x}} # Try doing updates on a unique column where the value does not # really change. # do_test update-10.1 { execsql { DROP TABLE test1; CREATE TABLE t1( a integer primary key, b UNIQUE, c, d, e, f, UNIQUE(c,d) ); INSERT INTO t1 VALUES(1,2,3,4,5,6); INSERT INTO t1 VALUES(2,3,4,4,6,7); SELECT * FROM t1 } } {1 2 3 4 5 6 2 3 4 4 6 7} do_test update-10.2 { catchsql { UPDATE t1 SET a=1, e=9 WHERE f=6; SELECT * FROM t1; } } {0 {1 2 3 4 9 6 2 3 4 4 6 7}} do_test update-10.3 { catchsql { UPDATE t1 SET a=1, e=10 WHERE f=7; SELECT * FROM t1; } } {1 {PRIMARY KEY must be unique}} do_test update-10.4 { catchsql { SELECT * FROM t1; } } {0 {1 2 3 4 9 6 2 3 4 4 6 7}} do_test update-10.5 { catchsql { UPDATE t1 SET b=2, e=11 WHERE f=6; SELECT * FROM t1; } } {0 {1 2 3 4 11 6 2 3 4 4 6 7}} do_test update-10.6 { catchsql { UPDATE t1 SET b=2, e=12 WHERE f=7; SELECT * FROM t1; } } {1 {column b is not unique}} do_test update-10.7 { catchsql { SELECT * FROM t1; } } {0 {1 2 3 4 11 6 2 3 4 4 6 7}} do_test update-10.8 { catchsql { UPDATE t1 SET c=3, d=4, e=13 WHERE f=6; SELECT * FROM t1; } } {0 {1 2 3 4 13 6 2 3 4 4 6 7}} do_test update-10.9 { catchsql { UPDATE t1 SET c=3, d=4, e=14 WHERE f=7; SELECT * FROM t1; } } {1 {columns c, d are not unique}} do_test update-10.10 { catchsql { SELECT * FROM t1; } } {0 {1 2 3 4 13 6 2 3 4 4 6 7}} # Make sure we can handle a subquery in the where clause. # do_test update-11.1 { execsql { UPDATE t1 SET e=e+1 WHERE b IN (SELECT b FROM t1); SELECT b,e FROM t1; } } {2 14 3 7} do_test update-11.2 { execsql { UPDATE t1 SET e=e+1 WHERE a IN (SELECT a FROM t1); SELECT a,e FROM t1; } } {1 15 2 8} integrity_check update-12.1 # Ticket 602. Updates should occur in the same order as the records # were discovered in the WHERE clause. # do_test update-13.1 { execsql { BEGIN; CREATE TABLE t2(a); INSERT INTO t2 VALUES(1); INSERT INTO t2 VALUES(2); INSERT INTO t2 SELECT a+2 FROM t2; INSERT INTO t2 SELECT a+4 FROM t2; INSERT INTO t2 SELECT a+8 FROM t2; INSERT INTO t2 SELECT a+16 FROM t2; INSERT INTO t2 SELECT a+32 FROM t2; INSERT INTO t2 SELECT a+64 FROM t2; INSERT INTO t2 SELECT a+128 FROM t2; INSERT INTO t2 SELECT a+256 FROM t2; INSERT INTO t2 SELECT a+512 FROM t2; INSERT INTO t2 SELECT a+1024 FROM t2; COMMIT; SELECT count(*) FROM t2; } } {2048} do_test update-13.2 { execsql { SELECT count(*) FROM t2 WHERE a=rowid; } } {2048} do_test update-13.3 { execsql { UPDATE t2 SET rowid=rowid-1; SELECT count(*) FROM t2 WHERE a=rowid+1; } } {2048} do_test update-13.3 { execsql { UPDATE t2 SET rowid=rowid+10000; UPDATE t2 SET rowid=rowid-9999; SELECT count(*) FROM t2 WHERE a=rowid; } } {2048} do_test update-13.4 { execsql { BEGIN; INSERT INTO t2 SELECT a+2048 FROM t2; INSERT INTO t2 SELECT a+4096 FROM t2; INSERT INTO t2 SELECT a+8192 FROM t2; SELECT count(*) FROM t2 WHERE a=rowid; COMMIT; } } 16384 do_test update-13.5 { execsql { UPDATE t2 SET rowid=rowid-1; SELECT count(*) FROM t2 WHERE a=rowid+1; } } 16384 integrity_check update-13.6 finish_test sqlite-2.8.17/test/attach2.test0000644000175000001440000000631510232547612016263 0ustar drhusers00000000000000# 2003 July 1 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: attach2.test,v 1.5 2004/02/12 15:31:22 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Ticket #354 # do_test attach2-1.1 { db eval { CREATE TABLE t1(a,b); CREATE INDEX x1 ON t1(a); } file delete -force test2.db file delete -force test2.db-journal sqlite db2 test2.db db2 eval { CREATE TABLE t1(a,b); CREATE INDEX x1 ON t1(a); } catchsql { ATTACH 'test2.db' AS t2; } } {0 {}} # Ticket #514 # proc db_list {db} { set list {} foreach {idx name file} [execsql {PRAGMA database_list} $db] { lappend list $idx $name } return $list } db eval {DETACH t2} do_test attach2-2.1 { # lock test2.db then try to attach it. Should get an error. db2 eval {BEGIN} catchsql { ATTACH 'test2.db' AS t2; } } {1 {database is locked}} do_test attach2-2.2 { # make sure test2.db did not get attached. db_list db } {0 main 1 temp} do_test attach2-2.3 { # unlock test2.db and try to attach again. should work this time. db2 eval {COMMIT} catchsql { ATTACH 'test2.db' AS t2; } } {0 {}} do_test attach2-2.4 { db_list db } {0 main 1 temp 2 t2} do_test attach2-2.5 { catchsql { SELECT name FROM t2.sqlite_master; } } {0 {t1 x1}} do_test attach2-2.6 { # lock test2.db and try to read from it. should get an error. db2 eval BEGIN catchsql { SELECT name FROM t2.sqlite_master; } } {1 {database is locked}} do_test attach2-2.7 { # but we can still read from test1.db even though test2.db is locked. catchsql { SELECT name FROM main.sqlite_master; } } {0 {t1 x1}} do_test attach2-2.8 { # start a transaction on test.db even though test2.db is locked. catchsql { BEGIN; INSERT INTO t1 VALUES(8,9); } } {0 {}} do_test attach2-2.9 { execsql { SELECT * FROM t1 } } {8 9} do_test attach2-2.10 { # now try to write to test2.db. the write should fail catchsql { INSERT INTO t2.t1 VALUES(1,2); } } {1 {database is locked}} do_test attach2-2.11 { # when the write failed in the previous test, the transaction should # have rolled back. db2 eval ROLLBACK execsql { SELECT * FROM t1 } } {} do_test attach2-2.12 { catchsql { COMMIT } } {1 {cannot commit - no transaction is active}} # Ticket #574: Make sure it works usingi the non-callback API # do_test attach2-3.1 { db close set DB [sqlite db test.db] set rc [catch {sqlite_compile $DB "ATTACH 'test2.db' AS t2" TAIL} VM] if {$rc} {lappend rc $VM} sqlite_finalize $VM set rc } {0} do_test attach2-3.2 { set rc [catch {sqlite_compile $DB "DETACH t2" TAIL} VM] if {$rc} {lappend rc $VM} sqlite_finalize $VM set rc } {0} db close for {set i 2} {$i<=15} {incr i} { catch {db$i close} } file delete -force test2.db finish_test sqlite-2.8.17/test/bind.test0000644000175000001440000000361410232547612015650 0ustar drhusers00000000000000# 2003 September 6 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the sqlite_bind API. # # $Id: bind.test,v 1.1 2003/09/06 22:45:21 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl do_test bind-1.1 { db close set DB [sqlite db test.db] execsql {CREATE TABLE t1(a,b,c)} set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(?,?,?)} TAIL] set TAIL } {} do_test bind-1.2 { sqlite_step $VM N VALUES COLNAMES } {SQLITE_DONE} do_test bind-1.3 { execsql {SELECT rowid, * FROM t1} } {1 {} {} {}} do_test bind-1.4 { sqlite_reset $VM sqlite_bind $VM 1 {test value 1} normal sqlite_step $VM N VALUES COLNAMES } SQLITE_DONE do_test bind-1.5 { execsql {SELECT rowid, * FROM t1} } {1 {} {} {} 2 {test value 1} {} {}} do_test bind-1.6 { sqlite_reset $VM sqlite_bind $VM 3 {'test value 2'} normal sqlite_step $VM N VALUES COLNAMES } SQLITE_DONE do_test bind-1.7 { execsql {SELECT rowid, * FROM t1} } {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}} do_test bind-1.8 { sqlite_reset $VM set sqlite_static_bind_value 123 sqlite_bind $VM 1 {} static sqlite_bind $VM 2 {abcdefg} normal sqlite_bind $VM 3 {} null execsql {DELETE FROM t1} sqlite_step $VM N VALUES COLNAMES execsql {SELECT rowid, * FROM t1} } {1 123 abcdefg {}} do_test bind-1.9 { sqlite_reset $VM sqlite_bind $VM 1 {456} normal sqlite_step $VM N VALUES COLNAMES execsql {SELECT rowid, * FROM t1} } {1 123 abcdefg {} 2 456 abcdefg {}} do_test bind-1.99 { sqlite_finalize $VM } {} finish_test sqlite-2.8.17/test/trans.test0000644000175000001440000004743310232547612016072 0ustar drhusers00000000000000# 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is database locks. # # $Id: trans.test,v 1.19 2004/03/08 13:26:18 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create several tables to work with. # do_test trans-1.0 { execsql { CREATE TABLE one(a int PRIMARY KEY, b text); INSERT INTO one VALUES(1,'one'); INSERT INTO one VALUES(2,'two'); INSERT INTO one VALUES(3,'three'); SELECT b FROM one ORDER BY a; } } {one two three} do_test trans-1.1 { execsql { CREATE TABLE two(a int PRIMARY KEY, b text); INSERT INTO two VALUES(1,'I'); INSERT INTO two VALUES(5,'V'); INSERT INTO two VALUES(10,'X'); SELECT b FROM two ORDER BY a; } } {I V X} do_test trans-1.9 { sqlite altdb test.db execsql {SELECT b FROM one ORDER BY a} altdb } {one two three} do_test trans-1.10 { execsql {SELECT b FROM two ORDER BY a} altdb } {I V X} integrity_check trans-1.11 # Basic transactions # do_test trans-2.1 { set v [catch {execsql {BEGIN}} msg] lappend v $msg } {0 {}} do_test trans-2.2 { set v [catch {execsql {END}} msg] lappend v $msg } {0 {}} do_test trans-2.3 { set v [catch {execsql {BEGIN TRANSACTION}} msg] lappend v $msg } {0 {}} do_test trans-2.4 { set v [catch {execsql {COMMIT TRANSACTION}} msg] lappend v $msg } {0 {}} do_test trans-2.5 { set v [catch {execsql {BEGIN TRANSACTION 'foo'}} msg] lappend v $msg } {0 {}} do_test trans-2.6 { set v [catch {execsql {ROLLBACK TRANSACTION 'foo'}} msg] lappend v $msg } {0 {}} do_test trans-2.10 { execsql { BEGIN; SELECT a FROM one ORDER BY a; SELECT a FROM two ORDER BY a; END; } } {1 2 3 1 5 10} integrity_check trans-2.11 # Check the locking behavior # do_test trans-3.1 { execsql { BEGIN; SELECT a FROM one ORDER BY a; } } {1 2 3} do_test trans-3.2 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-3.3 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-3.4 { set v [catch {execsql { INSERT INTO one VALUES(4,'four'); }} msg] lappend v $msg } {0 {}} do_test trans-3.5 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-3.6 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-3.7 { set v [catch {execsql { INSERT INTO two VALUES(4,'IV'); }} msg] lappend v $msg } {0 {}} do_test trans-3.8 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-3.9 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-3.10 { execsql {END TRANSACTION} } {} do_test trans-3.11 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {0 {1 4 5 10}} do_test trans-3.12 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {0 {1 2 3 4}} do_test trans-3.13 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } db} msg] lappend v $msg } {0 {1 4 5 10}} do_test trans-3.14 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } db} msg] lappend v $msg } {0 {1 2 3 4}} integrity_check trans-3.15 do_test trans-4.1 { set v [catch {execsql { COMMIT; } db} msg] lappend v $msg } {1 {cannot commit - no transaction is active}} do_test trans-4.2 { set v [catch {execsql { ROLLBACK; } db} msg] lappend v $msg } {1 {cannot rollback - no transaction is active}} do_test trans-4.3 { set v [catch {execsql { BEGIN TRANSACTION; SELECT a FROM two ORDER BY a; } db} msg] lappend v $msg } {0 {1 4 5 10}} do_test trans-4.4 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-4.5 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-4.6 { set v [catch {execsql { BEGIN TRANSACTION; SELECT a FROM one ORDER BY a; } db} msg] lappend v $msg } {1 {cannot start a transaction within a transaction}} do_test trans-4.7 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-4.8 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {1 {database is locked}} do_test trans-4.9 { set v [catch {execsql { END TRANSACTION; SELECT a FROM two ORDER BY a; } db} msg] lappend v $msg } {0 {1 4 5 10}} do_test trans-4.10 { set v [catch {execsql { SELECT a FROM two ORDER BY a; } altdb} msg] lappend v $msg } {0 {1 4 5 10}} do_test trans-4.11 { set v [catch {execsql { SELECT a FROM one ORDER BY a; } altdb} msg] lappend v $msg } {0 {1 2 3 4}} integrity_check trans-4.12 do_test trans-4.98 { altdb close execsql { DROP TABLE one; DROP TABLE two; } } {} integrity_check trans-4.99 # Check out the commit/rollback behavior of the database # do_test trans-5.1 { execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} } {} do_test trans-5.2 { execsql {BEGIN TRANSACTION} execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} } {} do_test trans-5.3 { execsql {CREATE TABLE one(a text, b int)} execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} } {one} do_test trans-5.4 { execsql {SELECT a,b FROM one ORDER BY b} } {} do_test trans-5.5 { execsql {INSERT INTO one(a,b) VALUES('hello', 1)} execsql {SELECT a,b FROM one ORDER BY b} } {hello 1} do_test trans-5.6 { execsql {ROLLBACK} execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name} } {} do_test trans-5.7 { set v [catch { execsql {SELECT a,b FROM one ORDER BY b} } msg] lappend v $msg } {1 {no such table: one}} # Test commits and rollbacks of table CREATE TABLEs, CREATE INDEXs # DROP TABLEs and DROP INDEXs # do_test trans-5.8 { execsql { SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name } } {} do_test trans-5.9 { execsql { BEGIN TRANSACTION; CREATE TABLE t1(a int, b int, c int); SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {t1} do_test trans-5.10 { execsql { CREATE INDEX i1 ON t1(a); SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i1 t1} do_test trans-5.11 { execsql { COMMIT; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i1 t1} do_test trans-5.12 { execsql { BEGIN TRANSACTION; CREATE TABLE t2(a int, b int, c int); CREATE INDEX i2a ON t2(a); CREATE INDEX i2b ON t2(b); DROP TABLE t1; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i2a i2b t2} do_test trans-5.13 { execsql { ROLLBACK; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i1 t1} do_test trans-5.14 { execsql { BEGIN TRANSACTION; DROP INDEX i1; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {t1} do_test trans-5.15 { execsql { ROLLBACK; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i1 t1} do_test trans-5.16 { execsql { BEGIN TRANSACTION; DROP INDEX i1; CREATE TABLE t2(x int, y int, z int); CREATE INDEX i2x ON t2(x); CREATE INDEX i2y ON t2(y); INSERT INTO t2 VALUES(1,2,3); SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i2x i2y t1 t2} do_test trans-5.17 { execsql { COMMIT; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i2x i2y t1 t2} do_test trans-5.18 { execsql { SELECT * FROM t2; } } {1 2 3} do_test trans-5.19 { execsql { SELECT x FROM t2 WHERE y=2; } } {1} do_test trans-5.20 { execsql { BEGIN TRANSACTION; DROP TABLE t1; DROP TABLE t2; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {} do_test trans-5.21 { set r [catch {execsql { SELECT * FROM t2 }} msg] lappend r $msg } {1 {no such table: t2}} do_test trans-5.22 { execsql { ROLLBACK; SELECT name fROM sqlite_master WHERE type='table' OR type='index' ORDER BY name; } } {i2x i2y t1 t2} do_test trans-5.23 { execsql { SELECT * FROM t2; } } {1 2 3} integrity_check trans-5.23 # Try to DROP and CREATE tables and indices with the same name # within a transaction. Make sure ROLLBACK works. # do_test trans-6.1 { execsql2 { INSERT INTO t1 VALUES(1,2,3); BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(p,q,r); ROLLBACK; SELECT * FROM t1; } } {a 1 b 2 c 3} do_test trans-6.2 { execsql2 { INSERT INTO t1 VALUES(1,2,3); BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(p,q,r); COMMIT; SELECT * FROM t1; } } {} do_test trans-6.3 { execsql2 { INSERT INTO t1 VALUES(1,2,3); SELECT * FROM t1; } } {p 1 q 2 r 3} do_test trans-6.4 { execsql2 { BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(4,5,6); SELECT * FROM t1; DROP TABLE t1; } } {a 4 b 5 c 6} do_test trans-6.5 { execsql2 { ROLLBACK; SELECT * FROM t1; } } {p 1 q 2 r 3} do_test trans-6.6 { execsql2 { BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(4,5,6); SELECT * FROM t1; DROP TABLE t1; } } {a 4 b 5 c 6} do_test trans-6.7 { catchsql { COMMIT; SELECT * FROM t1; } } {1 {no such table: t1}} # Repeat on a table with an automatically generated index. # do_test trans-6.10 { execsql2 { CREATE TABLE t1(a unique,b,c); INSERT INTO t1 VALUES(1,2,3); BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(p unique,q,r); ROLLBACK; SELECT * FROM t1; } } {a 1 b 2 c 3} do_test trans-6.11 { execsql2 { BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(p unique,q,r); COMMIT; SELECT * FROM t1; } } {} do_test trans-6.12 { execsql2 { INSERT INTO t1 VALUES(1,2,3); SELECT * FROM t1; } } {p 1 q 2 r 3} do_test trans-6.13 { execsql2 { BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(a unique,b,c); INSERT INTO t1 VALUES(4,5,6); SELECT * FROM t1; DROP TABLE t1; } } {a 4 b 5 c 6} do_test trans-6.14 { execsql2 { ROLLBACK; SELECT * FROM t1; } } {p 1 q 2 r 3} do_test trans-6.15 { execsql2 { BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(a unique,b,c); INSERT INTO t1 VALUES(4,5,6); SELECT * FROM t1; DROP TABLE t1; } } {a 4 b 5 c 6} do_test trans-6.16 { catchsql { COMMIT; SELECT * FROM t1; } } {1 {no such table: t1}} do_test trans-6.20 { execsql { CREATE TABLE t1(a integer primary key,b,c); INSERT INTO t1 VALUES(1,-2,-3); INSERT INTO t1 VALUES(4,-5,-6); SELECT * FROM t1; } } {1 -2 -3 4 -5 -6} do_test trans-6.21 { execsql { CREATE INDEX i1 ON t1(b); SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.22 { execsql { BEGIN TRANSACTION; DROP INDEX i1; SELECT * FROM t1 WHERE b<1; ROLLBACK; } } {1 -2 -3 4 -5 -6} do_test trans-6.23 { execsql { SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.24 { execsql { BEGIN TRANSACTION; DROP TABLE t1; ROLLBACK; SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.25 { execsql { BEGIN TRANSACTION; DROP INDEX i1; CREATE INDEX i1 ON t1(c); SELECT * FROM t1 WHERE b<1; } } {1 -2 -3 4 -5 -6} do_test trans-6.26 { execsql { SELECT * FROM t1 WHERE c<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.27 { execsql { ROLLBACK; SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.28 { execsql { SELECT * FROM t1 WHERE c<1; } } {1 -2 -3 4 -5 -6} # The following repeats steps 6.20 through 6.28, but puts a "unique" # constraint the first field of the table in order to generate an # automatic index. # do_test trans-6.30 { execsql { BEGIN TRANSACTION; DROP TABLE t1; CREATE TABLE t1(a int unique,b,c); COMMIT; INSERT INTO t1 VALUES(1,-2,-3); INSERT INTO t1 VALUES(4,-5,-6); SELECT * FROM t1 ORDER BY a; } } {1 -2 -3 4 -5 -6} do_test trans-6.31 { execsql { CREATE INDEX i1 ON t1(b); SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.32 { execsql { BEGIN TRANSACTION; DROP INDEX i1; SELECT * FROM t1 WHERE b<1; ROLLBACK; } } {1 -2 -3 4 -5 -6} do_test trans-6.33 { execsql { SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.34 { execsql { BEGIN TRANSACTION; DROP TABLE t1; ROLLBACK; SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.35 { execsql { BEGIN TRANSACTION; DROP INDEX i1; CREATE INDEX i1 ON t1(c); SELECT * FROM t1 WHERE b<1; } } {1 -2 -3 4 -5 -6} do_test trans-6.36 { execsql { SELECT * FROM t1 WHERE c<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.37 { execsql { DROP INDEX i1; SELECT * FROM t1 WHERE c<1; } } {1 -2 -3 4 -5 -6} do_test trans-6.38 { execsql { ROLLBACK; SELECT * FROM t1 WHERE b<1; } } {4 -5 -6 1 -2 -3} do_test trans-6.39 { execsql { SELECT * FROM t1 WHERE c<1; } } {1 -2 -3 4 -5 -6} integrity_check trans-6.40 # Test to make sure rollback restores the database back to its original # state. # do_test trans-7.1 { execsql {BEGIN} for {set i 0} {$i<1000} {incr i} { set r1 [expr {rand()}] set r2 [expr {rand()}] set r3 [expr {rand()}] execsql "INSERT INTO t2 VALUES($r1,$r2,$r3)" } execsql {COMMIT} set ::checksum [execsql {SELECT md5sum(x,y,z) FROM t2}] set ::checksum2 [ execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} ] execsql {SELECT count(*) FROM t2} } {1001} do_test trans-7.2 { execsql {SELECT md5sum(x,y,z) FROM t2} } $checksum do_test trans-7.2.1 { execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} } $checksum2 do_test trans-7.3 { execsql { BEGIN; DELETE FROM t2; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.4 { execsql { BEGIN; INSERT INTO t2 SELECT * FROM t2; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.5 { execsql { BEGIN; DELETE FROM t2; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.6 { execsql { BEGIN; INSERT INTO t2 SELECT * FROM t2; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.7 { execsql { BEGIN; CREATE TABLE t3 AS SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t3; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.8 { execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} } $checksum2 do_test trans-7.9 { execsql { BEGIN; CREATE TEMP TABLE t3 AS SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t3; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.10 { execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} } $checksum2 do_test trans-7.11 { execsql { BEGIN; CREATE TEMP TABLE t3 AS SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t3; DROP INDEX i2x; DROP INDEX i2y; CREATE INDEX i3a ON t3(x); ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.12 { execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} } $checksum2 do_test trans-7.13 { execsql { BEGIN; DROP TABLE t2; ROLLBACK; SELECT md5sum(x,y,z) FROM t2; } } $checksum do_test trans-7.14 { execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} } $checksum2 integrity_check trans-7.15 # Arrange for another process to begin modifying the database but abort # and die in the middle of the modification. Then have this process read # the database. This process should detect the journal file and roll it # back. Verify that this happens correctly. # set fd [open test.tcl w] puts $fd { sqlite db test.db db eval { PRAGMA default_cache_size=20; BEGIN; CREATE TABLE t3 AS SELECT * FROM t2; DELETE FROM t2; } sqlite_abort } close $fd do_test trans-8.1 { catch {exec [info nameofexec] test.tcl} execsql {SELECT md5sum(x,y,z) FROM t2} } $checksum do_test trans-8.2 { execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} } $checksum2 integrity_check trans-8.3 # In the following sequence of tests, compute the MD5 sum of the content # of a table, make lots of modifications to that table, then do a rollback. # Verify that after the rollback, the MD5 checksum is unchanged. # do_test trans-9.1 { execsql { PRAGMA default_cache_size=10; } db close sqlite db test.db execsql { BEGIN; CREATE TABLE t3(x TEXT); INSERT INTO t3 VALUES(randstr(10,400)); INSERT INTO t3 VALUES(randstr(10,400)); INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; INSERT INTO t3 SELECT randstr(10,400) FROM t3; COMMIT; SELECT count(*) FROM t3; } } {1024} # The following procedure computes a "signature" for table "t3". If # T3 changes in any way, the signature should change. # # This is used to test ROLLBACK. We gather a signature for t3, then # make lots of changes to t3, then rollback and take another signature. # The two signatures should be the same. # proc signature {} { return [db eval {SELECT count(*), md5sum(x) FROM t3}] } # Repeat the following group of tests 20 times for quick testing and # 40 times for full testing. Each iteration of the test makes table # t3 a little larger, and thus takes a little longer, so doing 40 tests # is more than 2.0 times slower than doing 20 tests. Considerably more. # if {[info exists ISQUICK]} { set limit 20 } else { set limit 40 } # Do rollbacks. Make sure the signature does not change. # for {set i 2} {$i<=$limit} {incr i} { set ::sig [signature] set cnt [lindex $::sig 0] set ::journal_format [expr {($i%3)+1}] if {$i%2==0} { execsql {PRAGMA synchronous=FULL} } else { execsql {PRAGMA synchronous=NORMAL} } do_test trans-9.$i.1-$cnt { execsql { BEGIN; DELETE FROM t3 WHERE random()%10!=0; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; ROLLBACK; } signature } $sig do_test trans-9.$i.2-$cnt { execsql { BEGIN; DELETE FROM t3 WHERE random()%10!=0; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; DELETE FROM t3 WHERE random()%10!=0; INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; ROLLBACK; } signature } $sig if {$i<$limit} { do_test trans-9.$i.9-$cnt { execsql { INSERT INTO t3 SELECT randstr(10,400) FROM t3 WHERE random()%10==0; } } {} } set ::pager_old_format 0 } finish_test sqlite-2.8.17/tool/0000755000175000001440000000000010232547612014025 5ustar drhusers00000000000000sqlite-2.8.17/tool/CVS/0000755000175000001440000000000010251061265014454 5ustar drhusers00000000000000sqlite-2.8.17/tool/CVS/Tag0000644000175000001440000000001310232547612015110 0ustar drhusers00000000000000Tversion_2 sqlite-2.8.17/tool/CVS/Root0000644000175000001440000000004410232547612015324 0ustar drhusers00000000000000:pserver:drh@www.sqlite.org:/sqlite sqlite-2.8.17/tool/CVS/Repository0000644000175000001440000000001410232547612016555 0ustar drhusers00000000000000sqlite/tool sqlite-2.8.17/tool/CVS/Entries0000644000175000001440000000140110251061265016004 0ustar drhusers00000000000000/diffdb.c/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /lemon.c/1.20.2.2/Sat Apr 23 22:43:22 2005//Tversion_2 /lempar.c/1.12/Sat Apr 23 22:43:22 2005//Tversion_2 /memleak.awk/1.4/Sat Apr 23 22:43:22 2005//Tversion_2 /memleak2.awk/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /mkopts.tcl/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /opcodeDoc.awk/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /report1.txt/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /showdb.c/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /showjournal.c/1.2/Sat Apr 23 22:43:22 2005//Tversion_2 /space_used.tcl/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 /spaceanal.tcl/1.1.2.1/Sat Apr 23 22:43:22 2005//Tversion_2 /speedtest.tcl/1.6/Sat Apr 23 22:43:22 2005//Tversion_2 /speedtest2.tcl/1.1/Sat Apr 23 22:43:22 2005//Tversion_2 D sqlite-2.8.17/tool/speedtest2.tcl0000644000175000001440000001217310232547612016617 0ustar drhusers00000000000000#!/usr/bin/tclsh # # Run this script using TCLSH to do a speed comparison between # various versions of SQLite and PostgreSQL and MySQL # # Run a test # set cnt 1 proc runtest {title} { global cnt set sqlfile test$cnt.sql puts "

    Test $cnt: $title

    " incr cnt set fd [open $sqlfile r] set sql [string trim [read $fd [file size $sqlfile]]] close $fd set sx [split $sql \n] set n [llength $sx] if {$n>8} { set sql {} for {set i 0} {$i<3} {incr i} {append sql [lindex $sx $i]
    \n} append sql "... [expr {$n-6}] lines omitted
    \n" for {set i [expr {$n-3}]} {$i<$n} {incr i} { append sql [lindex $sx $i]
    \n } } else { regsub -all \n [string trim $sql]
    sql } puts "
    " puts "$sql" puts "
    " set format {} set delay 1000 exec sync; after $delay; set t [time "exec psql drh <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format PostgreSQL: $t] exec sync; after $delay; set t [time "exec mysql -f drh <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format MySQL: $t] # set t [time "exec ./sqlite232 s232.db <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format {SQLite 2.3.2:} $t] # set t [time "exec ./sqlite-100 s100.db <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format {SQLite 2.4 (cache=100):} $t] exec sync; after $delay; set t [time "exec ./sqlite240 s2k.db <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format {SQLite 2.4:} $t] exec sync; after $delay; set t [time "exec ./sqlite240 sns.db <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format {SQLite 2.4 (nosync):} $t] # set t [time "exec ./sqlite-t1 st1.db <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format {SQLite 2.4 (test):} $t] puts "
    %s   %.3f
    " } # Initialize the environment # expr srand(1) catch {exec /bin/sh -c {rm -f s*.db}} set fd [open clear.sql w] puts $fd { drop table t1; drop table t2; } close $fd catch {exec psql drh =1000} { set txt "[number_name [expr {$n/1000}]] thousand" set n [expr {$n%1000}] } else { set txt {} } if {$n>=100} { append txt " [lindex $::ones [expr {$n/100}]] hundred" set n [expr {$n%100}] } if {$n>=20} { append txt " [lindex $::tens [expr {$n/10}]]" set n [expr {$n%10}] } if {$n>0} { append txt " [lindex $::ones $n]" } set txt [string trim $txt] if {$txt==""} {set txt zero} return $txt } set fd [open test$cnt.sql w] puts $fd "BEGIN;" puts $fd "CREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } puts $fd "COMMIT;" close $fd runtest {25000 INSERTs in a transaction} set fd [open test$cnt.sql w] puts $fd "DELETE FROM t1;" close $fd runtest {DELETE everything} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } puts $fd "COMMIT;" close $fd runtest {25000 INSERTs in a transaction} set fd [open test$cnt.sql w] puts $fd "DELETE FROM t1;" close $fd runtest {DELETE everything} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } puts $fd "COMMIT;" close $fd runtest {25000 INSERTs in a transaction} set fd [open test$cnt.sql w] puts $fd "DELETE FROM t1;" close $fd runtest {DELETE everything} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } puts $fd "COMMIT;" close $fd runtest {25000 INSERTs in a transaction} set fd [open test$cnt.sql w] puts $fd "DELETE FROM t1;" close $fd runtest {DELETE everything} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } puts $fd "COMMIT;" close $fd runtest {25000 INSERTs in a transaction} set fd [open test$cnt.sql w] puts $fd "DELETE FROM t1;" close $fd runtest {DELETE everything} set fd [open test$cnt.sql w] puts $fd {DROP TABLE t1;} close $fd runtest {DROP TABLE} sqlite-2.8.17/tool/diffdb.c0000644000175000001440000000172010232547612015407 0ustar drhusers00000000000000/* ** A utility for printing the differences between two SQLite database files. */ #include #include #include #include #include #include #include #define PAGESIZE 1024 static int db1 = -1; static int db2 = -1; int main(int argc, char **argv){ int iPg; unsigned char a1[PAGESIZE], a2[PAGESIZE]; if( argc!=3 ){ fprintf(stderr,"Usage: %s FILENAME FILENAME\n", argv[0]); exit(1); } db1 = open(argv[1], O_RDONLY); if( db1<0 ){ fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]); exit(1); } db2 = open(argv[2], O_RDONLY); if( db2<0 ){ fprintf(stderr,"%s: can't open %s\n", argv[0], argv[2]); exit(1); } iPg = 1; while( read(db1, a1, PAGESIZE)==PAGESIZE && read(db2,a2,PAGESIZE)==PAGESIZE ){ if( memcmp(a1,a2,PAGESIZE) ){ printf("Page %d\n", iPg); } iPg++; } printf("%d pages checked\n", iPg-1); close(db1); close(db2); } sqlite-2.8.17/tool/report1.txt0000644000175000001440000000412110232547612016160 0ustar drhusers00000000000000The SQL database used for ACD contains 113 tables and indices implemented in GDBM. The following are statistics on the sizes of keys and data within these tables and indices. Entries: 962080 Size: 45573853 Avg Size: 48 Key Size: 11045299 Avg Key Size: 12 Max Key Size: 99 Size of key Cummulative and data Instances Percentage ------------ ---------- ----------- 0..8 266 0% 9..12 5485 0% 13..16 73633 8% 17..24 180918 27% 25..32 209823 48% 33..40 148995 64% 41..48 76304 72% 49..56 14346 73% 57..64 15725 75% 65..80 44916 80% 81..96 127815 93% 97..112 34769 96% 113..128 13314 98% 129..144 8098 99% 145..160 3355 99% 161..176 1159 99% 177..192 629 99% 193..208 221 99% 209..224 210 99% 225..240 129 99% 241..256 57 99% 257..288 496 99% 289..320 60 99% 321..352 37 99% 353..384 46 99% 385..416 22 99% 417..448 24 99% 449..480 26 99% 481..512 27 99% 513..1024 471 99% 1025..2048 389 99% 2049..4096 182 99% 4097..8192 74 99% 8193..16384 34 99% 16385..32768 17 99% 32769..65536 5 99% 65537..131073 3 100% This information is gathered to help design the new built-in backend for sqlite 2.0. Note in particular that 99% of all database entries have a combined key and data size of less than 144 bytes. So if a leaf node in the new database is able to store 144 bytes of combined key and data, only 1% of the leaves will require overflow pages. Furthermore, note that no key is larger than 99 bytes, so if the key will never be on an overflow page. The average combined size of key+data is 48. Add in 16 bytes of overhead for a total of 64. That means that a 1K page will store (on average) about 16 entries. sqlite-2.8.17/tool/showdb.c0000644000175000001440000000363110232547612015462 0ustar drhusers00000000000000/* ** A utility for printing all or part of an SQLite database file. */ #include #include #include #include #include #include #include static int pagesize = 1024; static int db = -1; static int mxPage = 0; static void out_of_memory(void){ fprintf(stderr,"Out of memory...\n"); exit(1); } static print_page(int iPg){ unsigned char *aData; int i, j; aData = malloc(pagesize); if( aData==0 ) out_of_memory(); lseek(db, (iPg-1)*pagesize, SEEK_SET); read(db, aData, pagesize); fprintf(stdout, "Page %d:\n", iPg); for(i=0; imxPage ){ fprintf(stderr, "Page argument should be LOWER?..UPPER?. Range 1 to %d\n", mxPage); exit(1); } while( iStart<=iEnd ){ print_page(iStart); iStart++; } } } close(db); } sqlite-2.8.17/tool/lemon.c0000600000175000001440000037301110232547612015300 0ustar drhusers00000000000000/* ** This file contains all sources (including headers) to the LEMON ** LALR(1) parser generator. The sources have been combined into a ** single file to make it easy to include LEMON in the source tree ** and Makefile of another program. ** ** The author of this program disclaims copyright. */ #include #include #include #include #include #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) # define __WIN32__ # endif #endif /* #define PRIVATE static */ #define PRIVATE #ifdef TEST #define MAXRHS 5 /* Set low to exercise exception code */ #else #define MAXRHS 1000 #endif char *msort(); extern void *malloc(); /******** From the file "action.h" *************************************/ struct action *Action_new(); struct action *Action_sort(); /********* From the file "assert.h" ************************************/ void myassert(); #ifndef NDEBUG # define assert(X) if(!(X))myassert(__FILE__,__LINE__) #else # define assert(X) #endif /********** From the file "build.h" ************************************/ void FindRulePrecedences(); void FindFirstSets(); void FindStates(); void FindLinks(); void FindFollowSets(); void FindActions(); /********* From the file "configlist.h" *********************************/ void Configlist_init(/* void */); struct config *Configlist_add(/* struct rule *, int */); struct config *Configlist_addbasis(/* struct rule *, int */); void Configlist_closure(/* void */); void Configlist_sort(/* void */); void Configlist_sortbasis(/* void */); struct config *Configlist_return(/* void */); struct config *Configlist_basis(/* void */); void Configlist_eat(/* struct config * */); void Configlist_reset(/* void */); /********* From the file "error.h" ***************************************/ void ErrorMsg(const char *, int,const char *, ...); /****** From the file "option.h" ******************************************/ struct s_options { enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; char *label; char *arg; char *message; }; int OptInit(/* char**,struct s_options*,FILE* */); int OptNArgs(/* void */); char *OptArg(/* int */); void OptErr(/* int */); void OptPrint(/* void */); /******** From the file "parse.h" *****************************************/ void Parse(/* struct lemon *lemp */); /********* From the file "plink.h" ***************************************/ struct plink *Plink_new(/* void */); void Plink_add(/* struct plink **, struct config * */); void Plink_copy(/* struct plink **, struct plink * */); void Plink_delete(/* struct plink * */); /********** From the file "report.h" *************************************/ void Reprint(/* struct lemon * */); void ReportOutput(/* struct lemon * */); void ReportTable(/* struct lemon * */); void ReportHeader(/* struct lemon * */); void CompressTables(/* struct lemon * */); /********** From the file "set.h" ****************************************/ void SetSize(/* int N */); /* All sets will be of size N */ char *SetNew(/* void */); /* A new set for element 0..N */ void SetFree(/* char* */); /* Deallocate a set */ int SetAdd(/* char*,int */); /* Add element to a set */ int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ #define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ /********** From the file "struct.h" *************************************/ /* ** Principal data structures for the LEMON parser generator. */ typedef enum {B_FALSE=0, B_TRUE} Boolean; /* Symbols (terminals and nonterminals) of the grammar are stored ** in the following: */ struct symbol { char *name; /* Name of the symbol */ int index; /* Index number for this symbol */ enum { TERMINAL, NONTERMINAL } type; /* Symbols are all either TERMINALS or NTs */ struct rule *rule; /* Linked list of rules of this (if an NT) */ struct symbol *fallback; /* fallback token in case this token doesn't parse */ int prec; /* Precedence if defined (-1 otherwise) */ enum e_assoc { LEFT, RIGHT, NONE, UNK } assoc; /* Associativity if predecence is defined */ char *firstset; /* First-set for all rules of this symbol */ Boolean lambda; /* True if NT and can generate an empty string */ char *destructor; /* Code which executes whenever this symbol is ** popped from the stack during error processing */ int destructorln; /* Line number of destructor code */ char *datatype; /* The data type of information held by this ** object. Only used if type==NONTERMINAL */ int dtnum; /* The data type number. In the parser, the value ** stack is a union. The .yy%d element of this ** union is the correct data type for this object */ }; /* Each production rule in the grammar is stored in the following ** structure. */ struct rule { struct symbol *lhs; /* Left-hand side of the rule */ char *lhsalias; /* Alias for the LHS (NULL if none) */ int ruleline; /* Line number for the rule */ int nrhs; /* Number of RHS symbols */ struct symbol **rhs; /* The RHS symbols */ char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ int line; /* Line number at which code begins */ char *code; /* The code executed when this rule is reduced */ struct symbol *precsym; /* Precedence symbol for this rule */ int index; /* An index number for this rule */ Boolean canReduce; /* True if this rule is ever reduced */ struct rule *nextlhs; /* Next rule with the same LHS */ struct rule *next; /* Next rule in the global list */ }; /* A configuration is a production rule of the grammar together with ** a mark (dot) showing how much of that rule has been processed so far. ** Configurations also contain a follow-set which is a list of terminal ** symbols which are allowed to immediately follow the end of the rule. ** Every configuration is recorded as an instance of the following: */ struct config { struct rule *rp; /* The rule upon which the configuration is based */ int dot; /* The parse point */ char *fws; /* Follow-set for this configuration only */ struct plink *fplp; /* Follow-set forward propagation links */ struct plink *bplp; /* Follow-set backwards propagation links */ struct state *stp; /* Pointer to state which contains this */ enum { COMPLETE, /* The status is used during followset and */ INCOMPLETE /* shift computations */ } status; struct config *next; /* Next configuration in the state */ struct config *bp; /* The next basis configuration */ }; /* Every shift or reduce operation is stored as one of the following */ struct action { struct symbol *sp; /* The look-ahead symbol */ enum e_action { SHIFT, ACCEPT, REDUCE, ERROR, CONFLICT, /* Was a reduce, but part of a conflict */ SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ NOT_USED /* Deleted by compression */ } type; union { struct state *stp; /* The new state, if a shift */ struct rule *rp; /* The rule, if a reduce */ } x; struct action *next; /* Next action for this state */ struct action *collide; /* Next action with the same hash */ }; /* Each state of the generated parser's finite state machine ** is encoded as an instance of the following structure. */ struct state { struct config *bp; /* The basis configurations for this state */ struct config *cfp; /* All configurations in this set */ int index; /* Sequencial number for this state */ struct action *ap; /* Array of actions for this state */ int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ int iDflt; /* Default action */ }; #define NO_OFFSET (-2147483647) /* A followset propagation link indicates that the contents of one ** configuration followset should be propagated to another whenever ** the first changes. */ struct plink { struct config *cfp; /* The configuration to which linked */ struct plink *next; /* The next propagate link */ }; /* The state vector for the entire parser generator is recorded as ** follows. (LEMON uses no global variables and makes little use of ** static variables. Fields in the following structure can be thought ** of as begin global variables in the program.) */ struct lemon { struct state **sorted; /* Table of states sorted by state number */ struct rule *rule; /* List of all rules */ int nstate; /* Number of states */ int nrule; /* Number of rules */ int nsymbol; /* Number of terminal and nonterminal symbols */ int nterminal; /* Number of terminal symbols */ struct symbol **symbols; /* Sorted array of pointers to symbols */ int errorcnt; /* Number of errors */ struct symbol *errsym; /* The error symbol */ char *name; /* Name of the generated parser */ char *arg; /* Declaration of the 3th argument to parser */ char *tokentype; /* Type of terminal symbols in the parser stack */ char *vartype; /* The default type of non-terminal symbols */ char *start; /* Name of the start symbol for the grammar */ char *stacksize; /* Size of the parser stack */ char *include; /* Code to put at the start of the C file */ int includeln; /* Line number for start of include code */ char *error; /* Code to execute when an error is seen */ int errorln; /* Line number for start of error code */ char *overflow; /* Code to execute on a stack overflow */ int overflowln; /* Line number for start of overflow code */ char *failure; /* Code to execute on parser failure */ int failureln; /* Line number for start of failure code */ char *accept; /* Code to execute when the parser excepts */ int acceptln; /* Line number for the start of accept code */ char *extracode; /* Code appended to the generated file */ int extracodeln; /* Line number for the start of the extra code */ char *tokendest; /* Code to execute to destroy token data */ int tokendestln; /* Line number for token destroyer code */ char *vardest; /* Code for the default non-terminal destructor */ int vardestln; /* Line number for default non-term destructor code*/ char *filename; /* Name of the input file */ char *outname; /* Name of the current output file */ char *tokenprefix; /* A prefix added to token names in the .h file */ int nconflict; /* Number of parsing conflicts */ int tablesize; /* Size of the parse tables */ int basisflag; /* Print only basis configurations */ int has_fallback; /* True if any %fallback is seen in the grammer */ char *argv0; /* Name of the program */ }; #define MemoryCheck(X) if((X)==0){ \ extern void memory_error(); \ memory_error(); \ } /**************** From the file "table.h" *********************************/ /* ** All code in this file has been automatically generated ** from a specification in the file ** "table.q" ** by the associative array code building program "aagen". ** Do not edit this file! Instead, edit the specification ** file, then rerun aagen. */ /* ** Code for processing tables in the LEMON parser generator. */ /* Routines for handling a strings */ char *Strsafe(); void Strsafe_init(/* void */); int Strsafe_insert(/* char * */); char *Strsafe_find(/* char * */); /* Routines for handling symbols of the grammar */ struct symbol *Symbol_new(); int Symbolcmpp(/* struct symbol **, struct symbol ** */); void Symbol_init(/* void */); int Symbol_insert(/* struct symbol *, char * */); struct symbol *Symbol_find(/* char * */); struct symbol *Symbol_Nth(/* int */); int Symbol_count(/* */); struct symbol **Symbol_arrayof(/* */); /* Routines to manage the state table */ int Configcmp(/* struct config *, struct config * */); struct state *State_new(); void State_init(/* void */); int State_insert(/* struct state *, struct config * */); struct state *State_find(/* struct config * */); struct state **State_arrayof(/* */); /* Routines used for efficiency in Configlist_add */ void Configtable_init(/* void */); int Configtable_insert(/* struct config * */); struct config *Configtable_find(/* struct config * */); void Configtable_clear(/* int(*)(struct config *) */); /****************** From the file "action.c" *******************************/ /* ** Routines processing parser actions in the LEMON parser generator. */ /* Allocate a new parser action */ struct action *Action_new(){ static struct action *freelist = 0; struct action *new; if( freelist==0 ){ int i; int amt = 100; freelist = (struct action *)malloc( sizeof(struct action)*amt ); if( freelist==0 ){ fprintf(stderr,"Unable to allocate memory for a new parser action."); exit(1); } for(i=0; inext; return new; } /* Compare two actions */ static int actioncmp(ap1,ap2) struct action *ap1; struct action *ap2; { int rc; rc = ap1->sp->index - ap2->sp->index; if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; if( rc==0 ){ assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); rc = ap1->x.rp->index - ap2->x.rp->index; } return rc; } /* Sort parser actions */ struct action *Action_sort(ap) struct action *ap; { ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); return ap; } void Action_add(app,type,sp,arg) struct action **app; enum e_action type; struct symbol *sp; char *arg; { struct action *new; new = Action_new(); new->next = *app; *app = new; new->type = type; new->sp = sp; if( type==SHIFT ){ new->x.stp = (struct state *)arg; }else{ new->x.rp = (struct rule *)arg; } } /********************** New code to implement the "acttab" module ***********/ /* ** This module implements routines use to construct the yy_action[] table. */ /* ** The state of the yy_action table under construction is an instance of ** the following structure */ typedef struct acttab acttab; struct acttab { int nAction; /* Number of used slots in aAction[] */ int nActionAlloc; /* Slots allocated for aAction[] */ struct { int lookahead; /* Value of the lookahead token */ int action; /* Action to take on the given lookahead */ } *aAction, /* The yy_action[] table under construction */ *aLookahead; /* A single new transaction set */ int mnLookahead; /* Minimum aLookahead[].lookahead */ int mnAction; /* Action associated with mnLookahead */ int mxLookahead; /* Maximum aLookahead[].lookahead */ int nLookahead; /* Used slots in aLookahead[] */ int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ }; /* Return the number of entries in the yy_action table */ #define acttab_size(X) ((X)->nAction) /* The value for the N-th entry in yy_action */ #define acttab_yyaction(X,N) ((X)->aAction[N].action) /* The value for the N-th entry in yy_lookahead */ #define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) /* Free all memory associated with the given acttab */ void acttab_free(acttab *p){ free( p->aAction ); free( p->aLookahead ); free( p ); } /* Allocate a new acttab structure */ acttab *acttab_alloc(void){ acttab *p = malloc( sizeof(*p) ); if( p==0 ){ fprintf(stderr,"Unable to allocate memory for a new acttab."); exit(1); } memset(p, 0, sizeof(*p)); return p; } /* Add a new action to the current transaction set */ void acttab_action(acttab *p, int lookahead, int action){ if( p->nLookahead>=p->nLookaheadAlloc ){ p->nLookaheadAlloc += 25; p->aLookahead = realloc( p->aLookahead, sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); if( p->aLookahead==0 ){ fprintf(stderr,"malloc failed\n"); exit(1); } } if( p->nLookahead==0 ){ p->mxLookahead = lookahead; p->mnLookahead = lookahead; p->mnAction = action; }else{ if( p->mxLookaheadmxLookahead = lookahead; if( p->mnLookahead>lookahead ){ p->mnLookahead = lookahead; p->mnAction = action; } } p->aLookahead[p->nLookahead].lookahead = lookahead; p->aLookahead[p->nLookahead].action = action; p->nLookahead++; } /* ** Add the transaction set built up with prior calls to acttab_action() ** into the current action table. Then reset the transaction set back ** to an empty set in preparation for a new round of acttab_action() calls. ** ** Return the offset into the action table of the new transaction. */ int acttab_insert(acttab *p){ int i, j, k, n; assert( p->nLookahead>0 ); /* Make sure we have enough space to hold the expanded action table ** in the worst case. The worst case occurs if the transaction set ** must be appended to the current action table */ n = p->mxLookahead + 1; if( p->nAction + n >= p->nActionAlloc ){ int oldAlloc = p->nActionAlloc; p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; p->aAction = realloc( p->aAction, sizeof(p->aAction[0])*p->nActionAlloc); if( p->aAction==0 ){ fprintf(stderr,"malloc failed\n"); exit(1); } for(i=oldAlloc; inActionAlloc; i++){ p->aAction[i].lookahead = -1; p->aAction[i].action = -1; } } /* Scan the existing action table looking for an offset where we can ** insert the current transaction set. Fall out of the loop when that ** offset is found. In the worst case, we fall out of the loop when ** i reaches p->nAction, which means we append the new transaction set. ** ** i is the index in p->aAction[] where p->mnLookahead is inserted. */ for(i=0; inAction+p->mnLookahead; i++){ if( p->aAction[i].lookahead<0 ){ for(j=0; jnLookahead; j++){ k = p->aLookahead[j].lookahead - p->mnLookahead + i; if( k<0 ) break; if( p->aAction[k].lookahead>=0 ) break; } if( jnLookahead ) continue; for(j=0; jnAction; j++){ if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; } if( j==p->nAction ){ break; /* Fits in empty slots */ } }else if( p->aAction[i].lookahead==p->mnLookahead ){ if( p->aAction[i].action!=p->mnAction ) continue; for(j=0; jnLookahead; j++){ k = p->aLookahead[j].lookahead - p->mnLookahead + i; if( k<0 || k>=p->nAction ) break; if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; if( p->aLookahead[j].action!=p->aAction[k].action ) break; } if( jnLookahead ) continue; n = 0; for(j=0; jnAction; j++){ if( p->aAction[j].lookahead<0 ) continue; if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; } if( n==p->nLookahead ){ break; /* Same as a prior transaction set */ } } } /* Insert transaction set at index i. */ for(j=0; jnLookahead; j++){ k = p->aLookahead[j].lookahead - p->mnLookahead + i; p->aAction[k] = p->aLookahead[j]; if( k>=p->nAction ) p->nAction = k+1; } p->nLookahead = 0; /* Return the offset that is added to the lookahead in order to get the ** index into yy_action of the action */ return i - p->mnLookahead; } /********************** From the file "assert.c" ****************************/ /* ** A more efficient way of handling assertions. */ void myassert(file,line) char *file; int line; { fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); exit(1); } /********************** From the file "build.c" *****************************/ /* ** Routines to construction the finite state machine for the LEMON ** parser generator. */ /* Find a precedence symbol of every rule in the grammar. ** ** Those rules which have a precedence symbol coded in the input ** grammar using the "[symbol]" construct will already have the ** rp->precsym field filled. Other rules take as their precedence ** symbol the first RHS symbol with a defined precedence. If there ** are not RHS symbols with a defined precedence, the precedence ** symbol field is left blank. */ void FindRulePrecedences(xp) struct lemon *xp; { struct rule *rp; for(rp=xp->rule; rp; rp=rp->next){ if( rp->precsym==0 ){ int i; for(i=0; inrhs; i++){ if( rp->rhs[i]->prec>=0 ){ rp->precsym = rp->rhs[i]; break; } } } } return; } /* Find all nonterminals which will generate the empty string. ** Then go back and compute the first sets of every nonterminal. ** The first set is the set of all terminal symbols which can begin ** a string generated by that nonterminal. */ void FindFirstSets(lemp) struct lemon *lemp; { int i; struct rule *rp; int progress; for(i=0; insymbol; i++){ lemp->symbols[i]->lambda = B_FALSE; } for(i=lemp->nterminal; insymbol; i++){ lemp->symbols[i]->firstset = SetNew(); } /* First compute all lambdas */ do{ progress = 0; for(rp=lemp->rule; rp; rp=rp->next){ if( rp->lhs->lambda ) continue; for(i=0; inrhs; i++){ if( rp->rhs[i]->lambda==B_FALSE ) break; } if( i==rp->nrhs ){ rp->lhs->lambda = B_TRUE; progress = 1; } } }while( progress ); /* Now compute all first sets */ do{ struct symbol *s1, *s2; progress = 0; for(rp=lemp->rule; rp; rp=rp->next){ s1 = rp->lhs; for(i=0; inrhs; i++){ s2 = rp->rhs[i]; if( s2->type==TERMINAL ){ progress += SetAdd(s1->firstset,s2->index); break; }else if( s1==s2 ){ if( s1->lambda==B_FALSE ) break; }else{ progress += SetUnion(s1->firstset,s2->firstset); if( s2->lambda==B_FALSE ) break; } } } }while( progress ); return; } /* Compute all LR(0) states for the grammar. Links ** are added to between some states so that the LR(1) follow sets ** can be computed later. */ PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ void FindStates(lemp) struct lemon *lemp; { struct symbol *sp; struct rule *rp; Configlist_init(); /* Find the start symbol */ if( lemp->start ){ sp = Symbol_find(lemp->start); if( sp==0 ){ ErrorMsg(lemp->filename,0, "The specified start symbol \"%s\" is not \ in a nonterminal of the grammar. \"%s\" will be used as the start \ symbol instead.",lemp->start,lemp->rule->lhs->name); lemp->errorcnt++; sp = lemp->rule->lhs; } }else{ sp = lemp->rule->lhs; } /* Make sure the start symbol doesn't occur on the right-hand side of ** any rule. Report an error if it does. (YACC would generate a new ** start symbol in this case.) */ for(rp=lemp->rule; rp; rp=rp->next){ int i; for(i=0; inrhs; i++){ if( rp->rhs[i]==sp ){ ErrorMsg(lemp->filename,0, "The start symbol \"%s\" occurs on the \ right-hand side of a rule. This will result in a parser which \ does not work properly.",sp->name); lemp->errorcnt++; } } } /* The basis configuration set for the first state ** is all rules which have the start symbol as their ** left-hand side */ for(rp=sp->rule; rp; rp=rp->nextlhs){ struct config *newcfp; newcfp = Configlist_addbasis(rp,0); SetAdd(newcfp->fws,0); } /* Compute the first state. All other states will be ** computed automatically during the computation of the first one. ** The returned pointer to the first state is not used. */ (void)getstate(lemp); return; } /* Return a pointer to a state which is described by the configuration ** list which has been built from calls to Configlist_add. */ PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ PRIVATE struct state *getstate(lemp) struct lemon *lemp; { struct config *cfp, *bp; struct state *stp; /* Extract the sorted basis of the new state. The basis was constructed ** by prior calls to "Configlist_addbasis()". */ Configlist_sortbasis(); bp = Configlist_basis(); /* Get a state with the same basis */ stp = State_find(bp); if( stp ){ /* A state with the same basis already exists! Copy all the follow-set ** propagation links from the state under construction into the ** preexisting state, then return a pointer to the preexisting state */ struct config *x, *y; for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ Plink_copy(&y->bplp,x->bplp); Plink_delete(x->fplp); x->fplp = x->bplp = 0; } cfp = Configlist_return(); Configlist_eat(cfp); }else{ /* This really is a new state. Construct all the details */ Configlist_closure(lemp); /* Compute the configuration closure */ Configlist_sort(); /* Sort the configuration closure */ cfp = Configlist_return(); /* Get a pointer to the config list */ stp = State_new(); /* A new state structure */ MemoryCheck(stp); stp->bp = bp; /* Remember the configuration basis */ stp->cfp = cfp; /* Remember the configuration closure */ stp->index = lemp->nstate++; /* Every state gets a sequence number */ stp->ap = 0; /* No actions, yet. */ State_insert(stp,stp->bp); /* Add to the state table */ buildshifts(lemp,stp); /* Recursively compute successor states */ } return stp; } /* Construct all successor states to the given state. A "successor" ** state is any state which can be reached by a shift action. */ PRIVATE void buildshifts(lemp,stp) struct lemon *lemp; struct state *stp; /* The state from which successors are computed */ { struct config *cfp; /* For looping thru the config closure of "stp" */ struct config *bcfp; /* For the inner loop on config closure of "stp" */ struct config *new; /* */ struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ struct state *newstp; /* A pointer to a successor state */ /* Each configuration becomes complete after it contibutes to a successor ** state. Initially, all configurations are incomplete */ for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; /* Loop through all configurations of the state "stp" */ for(cfp=stp->cfp; cfp; cfp=cfp->next){ if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ Configlist_reset(); /* Reset the new config set */ sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ /* For every configuration in the state "stp" which has the symbol "sp" ** following its dot, add the same configuration to the basis set under ** construction but with the dot shifted one symbol to the right. */ for(bcfp=cfp; bcfp; bcfp=bcfp->next){ if( bcfp->status==COMPLETE ) continue; /* Already used */ if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ if( bsp!=sp ) continue; /* Must be same as for "cfp" */ bcfp->status = COMPLETE; /* Mark this config as used */ new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); Plink_add(&new->bplp,bcfp); } /* Get a pointer to the state described by the basis configuration set ** constructed in the preceding loop */ newstp = getstate(lemp); /* The state "newstp" is reached from the state "stp" by a shift action ** on the symbol "sp" */ Action_add(&stp->ap,SHIFT,sp,(char *)newstp); } } /* ** Construct the propagation links */ void FindLinks(lemp) struct lemon *lemp; { int i; struct config *cfp, *other; struct state *stp; struct plink *plp; /* Housekeeping detail: ** Add to every propagate link a pointer back to the state to ** which the link is attached. */ for(i=0; instate; i++){ stp = lemp->sorted[i]; for(cfp=stp->cfp; cfp; cfp=cfp->next){ cfp->stp = stp; } } /* Convert all backlinks into forward links. Only the forward ** links are used in the follow-set computation. */ for(i=0; instate; i++){ stp = lemp->sorted[i]; for(cfp=stp->cfp; cfp; cfp=cfp->next){ for(plp=cfp->bplp; plp; plp=plp->next){ other = plp->cfp; Plink_add(&other->fplp,cfp); } } } } /* Compute all followsets. ** ** A followset is the set of all symbols which can come immediately ** after a configuration. */ void FindFollowSets(lemp) struct lemon *lemp; { int i; struct config *cfp; struct plink *plp; int progress; int change; for(i=0; instate; i++){ for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ cfp->status = INCOMPLETE; } } do{ progress = 0; for(i=0; instate; i++){ for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ if( cfp->status==COMPLETE ) continue; for(plp=cfp->fplp; plp; plp=plp->next){ change = SetUnion(plp->cfp->fws,cfp->fws); if( change ){ plp->cfp->status = INCOMPLETE; progress = 1; } } cfp->status = COMPLETE; } } }while( progress ); } static int resolve_conflict(); /* Compute the reduce actions, and resolve conflicts. */ void FindActions(lemp) struct lemon *lemp; { int i,j; struct config *cfp; struct state *stp; struct symbol *sp; struct rule *rp; /* Add all of the reduce actions ** A reduce action is added for each element of the followset of ** a configuration which has its dot at the extreme right. */ for(i=0; instate; i++){ /* Loop over all states */ stp = lemp->sorted[i]; for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ for(j=0; jnterminal; j++){ if( SetFind(cfp->fws,j) ){ /* Add a reduce action to the state "stp" which will reduce by the ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); } } } } } /* Add the accepting token */ if( lemp->start ){ sp = Symbol_find(lemp->start); if( sp==0 ) sp = lemp->rule->lhs; }else{ sp = lemp->rule->lhs; } /* Add to the first state (which is always the starting state of the ** finite state machine) an action to ACCEPT if the lookahead is the ** start nonterminal. */ Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); /* Resolve conflicts */ for(i=0; instate; i++){ struct action *ap, *nap; struct state *stp; stp = lemp->sorted[i]; assert( stp->ap ); stp->ap = Action_sort(stp->ap); for(ap=stp->ap; ap && ap->next; ap=ap->next){ for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ /* The two actions "ap" and "nap" have the same lookahead. ** Figure out which one should be used */ lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); } } } /* Report an error for each rule that can never be reduced. */ for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; for(i=0; instate; i++){ struct action *ap; for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; } } for(rp=lemp->rule; rp; rp=rp->next){ if( rp->canReduce ) continue; ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); lemp->errorcnt++; } } /* Resolve a conflict between the two given actions. If the ** conflict can't be resolve, return non-zero. ** ** NO LONGER TRUE: ** To resolve a conflict, first look to see if either action ** is on an error rule. In that case, take the action which ** is not associated with the error rule. If neither or both ** actions are associated with an error rule, then try to ** use precedence to resolve the conflict. ** ** If either action is a SHIFT, then it must be apx. This ** function won't work if apx->type==REDUCE and apy->type==SHIFT. */ static int resolve_conflict(apx,apy,errsym) struct action *apx; struct action *apy; struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ { struct symbol *spx, *spy; int errcnt = 0; assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ if( apx->type==SHIFT && apy->type==REDUCE ){ spx = apx->sp; spy = apy->x.rp->precsym; if( spy==0 || spx->prec<0 || spy->prec<0 ){ /* Not enough precedence information. */ apy->type = CONFLICT; errcnt++; }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ apy->type = RD_RESOLVED; }else if( spx->precprec ){ apx->type = SH_RESOLVED; }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ apy->type = RD_RESOLVED; /* associativity */ }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ apx->type = SH_RESOLVED; }else{ assert( spx->prec==spy->prec && spx->assoc==NONE ); apy->type = CONFLICT; errcnt++; } }else if( apx->type==REDUCE && apy->type==REDUCE ){ spx = apx->x.rp->precsym; spy = apy->x.rp->precsym; if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ apy->type = CONFLICT; errcnt++; }else if( spx->prec>spy->prec ){ apy->type = RD_RESOLVED; }else if( spx->precprec ){ apx->type = RD_RESOLVED; } }else{ assert( apx->type==SH_RESOLVED || apx->type==RD_RESOLVED || apx->type==CONFLICT || apy->type==SH_RESOLVED || apy->type==RD_RESOLVED || apy->type==CONFLICT ); /* The REDUCE/SHIFT case cannot happen because SHIFTs come before ** REDUCEs on the list. If we reach this point it must be because ** the parser conflict had already been resolved. */ } return errcnt; } /********************* From the file "configlist.c" *************************/ /* ** Routines to processing a configuration list and building a state ** in the LEMON parser generator. */ static struct config *freelist = 0; /* List of free configurations */ static struct config *current = 0; /* Top of list of configurations */ static struct config **currentend = 0; /* Last on list of configs */ static struct config *basis = 0; /* Top of list of basis configs */ static struct config **basisend = 0; /* End of list of basis configs */ /* Return a pointer to a new configuration */ PRIVATE struct config *newconfig(){ struct config *new; if( freelist==0 ){ int i; int amt = 3; freelist = (struct config *)malloc( sizeof(struct config)*amt ); if( freelist==0 ){ fprintf(stderr,"Unable to allocate memory for a new configuration."); exit(1); } for(i=0; inext; return new; } /* The configuration "old" is no longer used */ PRIVATE void deleteconfig(old) struct config *old; { old->next = freelist; freelist = old; } /* Initialized the configuration list builder */ void Configlist_init(){ current = 0; currentend = ¤t; basis = 0; basisend = &basis; Configtable_init(); return; } /* Initialized the configuration list builder */ void Configlist_reset(){ current = 0; currentend = ¤t; basis = 0; basisend = &basis; Configtable_clear(0); return; } /* Add another configuration to the configuration list */ struct config *Configlist_add(rp,dot) struct rule *rp; /* The rule */ int dot; /* Index into the RHS of the rule where the dot goes */ { struct config *cfp, model; assert( currentend!=0 ); model.rp = rp; model.dot = dot; cfp = Configtable_find(&model); if( cfp==0 ){ cfp = newconfig(); cfp->rp = rp; cfp->dot = dot; cfp->fws = SetNew(); cfp->stp = 0; cfp->fplp = cfp->bplp = 0; cfp->next = 0; cfp->bp = 0; *currentend = cfp; currentend = &cfp->next; Configtable_insert(cfp); } return cfp; } /* Add a basis configuration to the configuration list */ struct config *Configlist_addbasis(rp,dot) struct rule *rp; int dot; { struct config *cfp, model; assert( basisend!=0 ); assert( currentend!=0 ); model.rp = rp; model.dot = dot; cfp = Configtable_find(&model); if( cfp==0 ){ cfp = newconfig(); cfp->rp = rp; cfp->dot = dot; cfp->fws = SetNew(); cfp->stp = 0; cfp->fplp = cfp->bplp = 0; cfp->next = 0; cfp->bp = 0; *currentend = cfp; currentend = &cfp->next; *basisend = cfp; basisend = &cfp->bp; Configtable_insert(cfp); } return cfp; } /* Compute the closure of the configuration list */ void Configlist_closure(lemp) struct lemon *lemp; { struct config *cfp, *newcfp; struct rule *rp, *newrp; struct symbol *sp, *xsp; int i, dot; assert( currentend!=0 ); for(cfp=current; cfp; cfp=cfp->next){ rp = cfp->rp; dot = cfp->dot; if( dot>=rp->nrhs ) continue; sp = rp->rhs[dot]; if( sp->type==NONTERMINAL ){ if( sp->rule==0 && sp!=lemp->errsym ){ ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", sp->name); lemp->errorcnt++; } for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ newcfp = Configlist_add(newrp,0); for(i=dot+1; inrhs; i++){ xsp = rp->rhs[i]; if( xsp->type==TERMINAL ){ SetAdd(newcfp->fws,xsp->index); break; }else{ SetUnion(newcfp->fws,xsp->firstset); if( xsp->lambda==B_FALSE ) break; } } if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); } } } return; } /* Sort the configuration list */ void Configlist_sort(){ current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); currentend = 0; return; } /* Sort the basis configuration list */ void Configlist_sortbasis(){ basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); basisend = 0; return; } /* Return a pointer to the head of the configuration list and ** reset the list */ struct config *Configlist_return(){ struct config *old; old = current; current = 0; currentend = 0; return old; } /* Return a pointer to the head of the configuration list and ** reset the list */ struct config *Configlist_basis(){ struct config *old; old = basis; basis = 0; basisend = 0; return old; } /* Free all elements of the given configuration list */ void Configlist_eat(cfp) struct config *cfp; { struct config *nextcfp; for(; cfp; cfp=nextcfp){ nextcfp = cfp->next; assert( cfp->fplp==0 ); assert( cfp->bplp==0 ); if( cfp->fws ) SetFree(cfp->fws); deleteconfig(cfp); } return; } /***************** From the file "error.c" *********************************/ /* ** Code for printing error message. */ /* Find a good place to break "msg" so that its length is at least "min" ** but no more than "max". Make the point as close to max as possible. */ static int findbreak(msg,min,max) char *msg; int min; int max; { int i,spot; char c; for(i=spot=min; i<=max; i++){ c = msg[i]; if( c=='\t' ) msg[i] = ' '; if( c=='\n' ){ msg[i] = ' '; spot = i; break; } if( c==0 ){ spot = i; break; } if( c=='-' && i0 ){ sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); }else{ sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); } prefixsize = strlen(prefix); availablewidth = LINEWIDTH - prefixsize; /* Generate the error message */ vsprintf(errmsg,format,ap); va_end(ap); errmsgsize = strlen(errmsg); /* Remove trailing '\n's from the error message. */ while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ errmsg[--errmsgsize] = 0; } /* Print the error message */ base = 0; while( errmsg[base]!=0 ){ end = restart = findbreak(&errmsg[base],0,availablewidth); restart += base; while( errmsg[restart]==' ' ) restart++; fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); base = restart; } } /**************** From the file "main.c" ************************************/ /* ** Main program file for the LEMON parser generator. */ /* Report an out-of-memory condition and abort. This function ** is used mostly by the "MemoryCheck" macro in struct.h */ void memory_error(){ fprintf(stderr,"Out of memory. Aborting...\n"); exit(1); } /* The main program. Parse the command line and do it... */ int main(argc,argv) int argc; char **argv; { static int version = 0; static int rpflag = 0; static int basisflag = 0; static int compress = 0; static int quiet = 0; static int statistics = 0; static int mhflag = 0; static struct s_options options[] = { {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, {OPT_FLAG, "s", (char*)&statistics, "Print parser stats to standard output."}, {OPT_FLAG, "x", (char*)&version, "Print the version number."}, {OPT_FLAG,0,0,0} }; int i; struct lemon lem; OptInit(argv,options,stderr); if( version ){ printf("Lemon version 1.0\n"); exit(0); } if( OptNArgs()!=1 ){ fprintf(stderr,"Exactly one filename argument is required.\n"); exit(1); } lem.errorcnt = 0; /* Initialize the machine */ Strsafe_init(); Symbol_init(); State_init(); lem.argv0 = argv[0]; lem.filename = OptArg(0); lem.basisflag = basisflag; lem.has_fallback = 0; lem.nconflict = 0; lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; lem.vartype = 0; lem.stacksize = 0; lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = lem.tokenprefix = lem.outname = lem.extracode = 0; lem.vardest = 0; lem.tablesize = 0; Symbol_new("$"); lem.errsym = Symbol_new("error"); /* Parse the input file */ Parse(&lem); if( lem.errorcnt ) exit(lem.errorcnt); if( lem.rule==0 ){ fprintf(stderr,"Empty grammar.\n"); exit(1); } /* Count and index the symbols of the grammar */ lem.nsymbol = Symbol_count(); Symbol_new("{default}"); lem.symbols = Symbol_arrayof(); for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), (int(*)())Symbolcmpp); for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; for(i=1; isupper(lem.symbols[i]->name[0]); i++); lem.nterminal = i; /* Generate a reprint of the grammar, if requested on the command line */ if( rpflag ){ Reprint(&lem); }else{ /* Initialize the size for all follow and first sets */ SetSize(lem.nterminal); /* Find the precedence for every production rule (that has one) */ FindRulePrecedences(&lem); /* Compute the lambda-nonterminals and the first-sets for every ** nonterminal */ FindFirstSets(&lem); /* Compute all LR(0) states. Also record follow-set propagation ** links so that the follow-set can be computed later */ lem.nstate = 0; FindStates(&lem); lem.sorted = State_arrayof(); /* Tie up loose ends on the propagation links */ FindLinks(&lem); /* Compute the follow set of every reducible configuration */ FindFollowSets(&lem); /* Compute the action tables */ FindActions(&lem); /* Compress the action tables */ if( compress==0 ) CompressTables(&lem); /* Generate a report of the parser generated. (the "y.output" file) */ if( !quiet ) ReportOutput(&lem); /* Generate the source code for the parser */ ReportTable(&lem, mhflag); /* Produce a header file for use by the scanner. (This step is ** omitted if the "-m" option is used because makeheaders will ** generate the file for us.) */ if( !mhflag ) ReportHeader(&lem); } if( statistics ){ printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); printf(" %d states, %d parser table entries, %d conflicts\n", lem.nstate, lem.tablesize, lem.nconflict); } if( lem.nconflict ){ fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); } exit(lem.errorcnt + lem.nconflict); return (lem.errorcnt + lem.nconflict); } /******************** From the file "msort.c" *******************************/ /* ** A generic merge-sort program. ** ** USAGE: ** Let "ptr" be a pointer to some structure which is at the head of ** a null-terminated list. Then to sort the list call: ** ** ptr = msort(ptr,&(ptr->next),cmpfnc); ** ** In the above, "cmpfnc" is a pointer to a function which compares ** two instances of the structure and returns an integer, as in ** strcmp. The second argument is a pointer to the pointer to the ** second element of the linked list. This address is used to compute ** the offset to the "next" field within the structure. The offset to ** the "next" field must be constant for all structures in the list. ** ** The function returns a new pointer which is the head of the list ** after sorting. ** ** ALGORITHM: ** Merge-sort. */ /* ** Return a pointer to the next structure in the linked list. */ #define NEXT(A) (*(char**)(((unsigned long)A)+offset)) /* ** Inputs: ** a: A sorted, null-terminated linked list. (May be null). ** b: A sorted, null-terminated linked list. (May be null). ** cmp: A pointer to the comparison function. ** offset: Offset in the structure to the "next" field. ** ** Return Value: ** A pointer to the head of a sorted list containing the elements ** of both a and b. ** ** Side effects: ** The "next" pointers for elements in the lists a and b are ** changed. */ static char *merge(a,b,cmp,offset) char *a; char *b; int (*cmp)(); int offset; { char *ptr, *head; if( a==0 ){ head = b; }else if( b==0 ){ head = a; }else{ if( (*cmp)(a,b)<0 ){ ptr = a; a = NEXT(a); }else{ ptr = b; b = NEXT(b); } head = ptr; while( a && b ){ if( (*cmp)(a,b)<0 ){ NEXT(ptr) = a; ptr = a; a = NEXT(a); }else{ NEXT(ptr) = b; ptr = b; b = NEXT(b); } } if( a ) NEXT(ptr) = a; else NEXT(ptr) = b; } return head; } /* ** Inputs: ** list: Pointer to a singly-linked list of structures. ** next: Pointer to pointer to the second element of the list. ** cmp: A comparison function. ** ** Return Value: ** A pointer to the head of a sorted list containing the elements ** orginally in list. ** ** Side effects: ** The "next" pointers for elements in list are changed. */ #define LISTSIZE 30 char *msort(list,next,cmp) char *list; char **next; int (*cmp)(); { unsigned long offset; char *ep; char *set[LISTSIZE]; int i; offset = (unsigned long)next - (unsigned long)list; for(i=0; istate = WAITING_FOR_DECL_KEYWORD; }else if( islower(x[0]) ){ psp->lhs = Symbol_new(x); psp->nrhs = 0; psp->lhsalias = 0; psp->state = WAITING_FOR_ARROW; }else if( x[0]=='{' ){ if( psp->prevrule==0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "There is not prior rule opon which to attach the code \ fragment which begins on this line."); psp->errorcnt++; }else if( psp->prevrule->code!=0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "Code fragment beginning on this line is not the first \ to follow the previous rule."); psp->errorcnt++; }else{ psp->prevrule->line = psp->tokenlineno; psp->prevrule->code = &x[1]; } }else if( x[0]=='[' ){ psp->state = PRECEDENCE_MARK_1; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Token \"%s\" should be either \"%%\" or a nonterminal name.", x); psp->errorcnt++; } break; case PRECEDENCE_MARK_1: if( !isupper(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "The precedence symbol must be a terminal."); psp->errorcnt++; }else if( psp->prevrule==0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "There is no prior rule to assign precedence \"[%s]\".",x); psp->errorcnt++; }else if( psp->prevrule->precsym!=0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "Precedence mark on this line is not the first \ to follow the previous rule."); psp->errorcnt++; }else{ psp->prevrule->precsym = Symbol_new(x); } psp->state = PRECEDENCE_MARK_2; break; case PRECEDENCE_MARK_2: if( x[0]!=']' ){ ErrorMsg(psp->filename,psp->tokenlineno, "Missing \"]\" on precedence mark."); psp->errorcnt++; } psp->state = WAITING_FOR_DECL_OR_RULE; break; case WAITING_FOR_ARROW: if( x[0]==':' && x[1]==':' && x[2]=='=' ){ psp->state = IN_RHS; }else if( x[0]=='(' ){ psp->state = LHS_ALIAS_1; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Expected to see a \":\" following the LHS symbol \"%s\".", psp->lhs->name); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case LHS_ALIAS_1: if( isalpha(x[0]) ){ psp->lhsalias = x; psp->state = LHS_ALIAS_2; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "\"%s\" is not a valid alias for the LHS \"%s\"\n", x,psp->lhs->name); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case LHS_ALIAS_2: if( x[0]==')' ){ psp->state = LHS_ALIAS_3; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case LHS_ALIAS_3: if( x[0]==':' && x[1]==':' && x[2]=='=' ){ psp->state = IN_RHS; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Missing \"->\" following: \"%s(%s)\".", psp->lhs->name,psp->lhsalias); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case IN_RHS: if( x[0]=='.' ){ struct rule *rp; rp = (struct rule *)malloc( sizeof(struct rule) + sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); if( rp==0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "Can't allocate enough memory for this rule."); psp->errorcnt++; psp->prevrule = 0; }else{ int i; rp->ruleline = psp->tokenlineno; rp->rhs = (struct symbol**)&rp[1]; rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); for(i=0; inrhs; i++){ rp->rhs[i] = psp->rhs[i]; rp->rhsalias[i] = psp->alias[i]; } rp->lhs = psp->lhs; rp->lhsalias = psp->lhsalias; rp->nrhs = psp->nrhs; rp->code = 0; rp->precsym = 0; rp->index = psp->gp->nrule++; rp->nextlhs = rp->lhs->rule; rp->lhs->rule = rp; rp->next = 0; if( psp->firstrule==0 ){ psp->firstrule = psp->lastrule = rp; }else{ psp->lastrule->next = rp; psp->lastrule = rp; } psp->prevrule = rp; } psp->state = WAITING_FOR_DECL_OR_RULE; }else if( isalpha(x[0]) ){ if( psp->nrhs>=MAXRHS ){ ErrorMsg(psp->filename,psp->tokenlineno, "Too many symbol on RHS or rule beginning at \"%s\".", x); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; }else{ psp->rhs[psp->nrhs] = Symbol_new(x); psp->alias[psp->nrhs] = 0; psp->nrhs++; } }else if( x[0]=='(' && psp->nrhs>0 ){ psp->state = RHS_ALIAS_1; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Illegal character on RHS of rule: \"%s\".",x); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case RHS_ALIAS_1: if( isalpha(x[0]) ){ psp->alias[psp->nrhs-1] = x; psp->state = RHS_ALIAS_2; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", x,psp->rhs[psp->nrhs-1]->name); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case RHS_ALIAS_2: if( x[0]==')' ){ psp->state = IN_RHS; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); psp->errorcnt++; psp->state = RESYNC_AFTER_RULE_ERROR; } break; case WAITING_FOR_DECL_KEYWORD: if( isalpha(x[0]) ){ psp->declkeyword = x; psp->declargslot = 0; psp->decllnslot = 0; psp->state = WAITING_FOR_DECL_ARG; if( strcmp(x,"name")==0 ){ psp->declargslot = &(psp->gp->name); }else if( strcmp(x,"include")==0 ){ psp->declargslot = &(psp->gp->include); psp->decllnslot = &psp->gp->includeln; }else if( strcmp(x,"code")==0 ){ psp->declargslot = &(psp->gp->extracode); psp->decllnslot = &psp->gp->extracodeln; }else if( strcmp(x,"token_destructor")==0 ){ psp->declargslot = &psp->gp->tokendest; psp->decllnslot = &psp->gp->tokendestln; }else if( strcmp(x,"default_destructor")==0 ){ psp->declargslot = &psp->gp->vardest; psp->decllnslot = &psp->gp->vardestln; }else if( strcmp(x,"token_prefix")==0 ){ psp->declargslot = &psp->gp->tokenprefix; }else if( strcmp(x,"syntax_error")==0 ){ psp->declargslot = &(psp->gp->error); psp->decllnslot = &psp->gp->errorln; }else if( strcmp(x,"parse_accept")==0 ){ psp->declargslot = &(psp->gp->accept); psp->decllnslot = &psp->gp->acceptln; }else if( strcmp(x,"parse_failure")==0 ){ psp->declargslot = &(psp->gp->failure); psp->decllnslot = &psp->gp->failureln; }else if( strcmp(x,"stack_overflow")==0 ){ psp->declargslot = &(psp->gp->overflow); psp->decllnslot = &psp->gp->overflowln; }else if( strcmp(x,"extra_argument")==0 ){ psp->declargslot = &(psp->gp->arg); }else if( strcmp(x,"token_type")==0 ){ psp->declargslot = &(psp->gp->tokentype); }else if( strcmp(x,"default_type")==0 ){ psp->declargslot = &(psp->gp->vartype); }else if( strcmp(x,"stack_size")==0 ){ psp->declargslot = &(psp->gp->stacksize); }else if( strcmp(x,"start_symbol")==0 ){ psp->declargslot = &(psp->gp->start); }else if( strcmp(x,"left")==0 ){ psp->preccounter++; psp->declassoc = LEFT; psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; }else if( strcmp(x,"right")==0 ){ psp->preccounter++; psp->declassoc = RIGHT; psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; }else if( strcmp(x,"nonassoc")==0 ){ psp->preccounter++; psp->declassoc = NONE; psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; }else if( strcmp(x,"destructor")==0 ){ psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; }else if( strcmp(x,"type")==0 ){ psp->state = WAITING_FOR_DATATYPE_SYMBOL; }else if( strcmp(x,"fallback")==0 ){ psp->fallback = 0; psp->state = WAITING_FOR_FALLBACK_ID; }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Unknown declaration keyword: \"%%%s\".",x); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; } }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Illegal declaration keyword: \"%s\".",x); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; } break; case WAITING_FOR_DESTRUCTOR_SYMBOL: if( !isalpha(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "Symbol name missing after %destructor keyword"); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; }else{ struct symbol *sp = Symbol_new(x); psp->declargslot = &sp->destructor; psp->decllnslot = &sp->destructorln; psp->state = WAITING_FOR_DECL_ARG; } break; case WAITING_FOR_DATATYPE_SYMBOL: if( !isalpha(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "Symbol name missing after %destructor keyword"); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; }else{ struct symbol *sp = Symbol_new(x); psp->declargslot = &sp->datatype; psp->decllnslot = 0; psp->state = WAITING_FOR_DECL_ARG; } break; case WAITING_FOR_PRECEDENCE_SYMBOL: if( x[0]=='.' ){ psp->state = WAITING_FOR_DECL_OR_RULE; }else if( isupper(x[0]) ){ struct symbol *sp; sp = Symbol_new(x); if( sp->prec>=0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "Symbol \"%s\" has already be given a precedence.",x); psp->errorcnt++; }else{ sp->prec = psp->preccounter; sp->assoc = psp->declassoc; } }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Can't assign a precedence to \"%s\".",x); psp->errorcnt++; } break; case WAITING_FOR_DECL_ARG: if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ if( *(psp->declargslot)!=0 ){ ErrorMsg(psp->filename,psp->tokenlineno, "The argument \"%s\" to declaration \"%%%s\" is not the first.", x[0]=='\"' ? &x[1] : x,psp->declkeyword); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; }else{ *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; psp->state = WAITING_FOR_DECL_OR_RULE; } }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Illegal argument to %%%s: %s",psp->declkeyword,x); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; } break; case WAITING_FOR_FALLBACK_ID: if( x[0]=='.' ){ psp->state = WAITING_FOR_DECL_OR_RULE; }else if( !isupper(x[0]) ){ ErrorMsg(psp->filename, psp->tokenlineno, "%%fallback argument \"%s\" should be a token", x); psp->errorcnt++; }else{ struct symbol *sp = Symbol_new(x); if( psp->fallback==0 ){ psp->fallback = sp; }else if( sp->fallback ){ ErrorMsg(psp->filename, psp->tokenlineno, "More than one fallback assigned to token %s", x); psp->errorcnt++; }else{ sp->fallback = psp->fallback; psp->gp->has_fallback = 1; } } break; case RESYNC_AFTER_RULE_ERROR: /* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; ** break; */ case RESYNC_AFTER_DECL_ERROR: if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; break; } } /* In spite of its name, this function is really a scanner. It read ** in the entire input file (all at once) then tokenizes it. Each ** token is passed to the function "parseonetoken" which builds all ** the appropriate data structures in the global state vector "gp". */ void Parse(gp) struct lemon *gp; { struct pstate ps; FILE *fp; char *filebuf; int filesize; int lineno; int c; char *cp, *nextcp; int startline = 0; ps.gp = gp; ps.filename = gp->filename; ps.errorcnt = 0; ps.state = INITIALIZE; /* Begin by reading the input file */ fp = fopen(ps.filename,"rb"); if( fp==0 ){ ErrorMsg(ps.filename,0,"Can't open this file for reading."); gp->errorcnt++; return; } fseek(fp,0,2); filesize = ftell(fp); rewind(fp); filebuf = (char *)malloc( filesize+1 ); if( filebuf==0 ){ ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", filesize+1); gp->errorcnt++; return; } if( fread(filebuf,1,filesize,fp)!=filesize ){ ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", filesize); free(filebuf); gp->errorcnt++; return; } fclose(fp); filebuf[filesize] = 0; /* Now scan the text of the input file */ lineno = 1; for(cp=filebuf; (c= *cp)!=0; ){ if( c=='\n' ) lineno++; /* Keep track of the line number */ if( isspace(c) ){ cp++; continue; } /* Skip all white space */ if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ cp+=2; while( (c= *cp)!=0 && c!='\n' ) cp++; continue; } if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ cp+=2; while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ if( c=='\n' ) lineno++; cp++; } if( c ) cp++; continue; } ps.tokenstart = cp; /* Mark the beginning of the token */ ps.tokenlineno = lineno; /* Linenumber on which token begins */ if( c=='\"' ){ /* String literals */ cp++; while( (c= *cp)!=0 && c!='\"' ){ if( c=='\n' ) lineno++; cp++; } if( c==0 ){ ErrorMsg(ps.filename,startline, "String starting on this line is not terminated before the end of the file."); ps.errorcnt++; nextcp = cp; }else{ nextcp = cp+1; } }else if( c=='{' ){ /* A block of C code */ int level; cp++; for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ if( c=='\n' ) lineno++; else if( c=='{' ) level++; else if( c=='}' ) level--; else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ int prevc; cp = &cp[2]; prevc = 0; while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ if( c=='\n' ) lineno++; prevc = c; cp++; } }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ cp = &cp[2]; while( (c= *cp)!=0 && c!='\n' ) cp++; if( c ) lineno++; }else if( c=='\'' || c=='\"' ){ /* String a character literals */ int startchar, prevc; startchar = c; prevc = 0; for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ if( c=='\n' ) lineno++; if( prevc=='\\' ) prevc = 0; else prevc = c; } } } if( c==0 ){ ErrorMsg(ps.filename,ps.tokenlineno, "C code starting on this line is not terminated before the end of the file."); ps.errorcnt++; nextcp = cp; }else{ nextcp = cp+1; } }else if( isalnum(c) ){ /* Identifiers */ while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; nextcp = cp; }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ cp += 3; nextcp = cp; }else{ /* All other (one character) operators */ cp++; nextcp = cp; } c = *cp; *cp = 0; /* Null terminate the token */ parseonetoken(&ps); /* Parse the token */ *cp = c; /* Restore the buffer */ cp = nextcp; } free(filebuf); /* Release the buffer after parsing */ gp->rule = ps.firstrule; gp->errorcnt = ps.errorcnt; } /*************************** From the file "plink.c" *********************/ /* ** Routines processing configuration follow-set propagation links ** in the LEMON parser generator. */ static struct plink *plink_freelist = 0; /* Allocate a new plink */ struct plink *Plink_new(){ struct plink *new; if( plink_freelist==0 ){ int i; int amt = 100; plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); if( plink_freelist==0 ){ fprintf(stderr, "Unable to allocate memory for a new follow-set propagation link.\n"); exit(1); } for(i=0; inext; return new; } /* Add a plink to a plink list */ void Plink_add(plpp,cfp) struct plink **plpp; struct config *cfp; { struct plink *new; new = Plink_new(); new->next = *plpp; *plpp = new; new->cfp = cfp; } /* Transfer every plink on the list "from" to the list "to" */ void Plink_copy(to,from) struct plink **to; struct plink *from; { struct plink *nextpl; while( from ){ nextpl = from->next; from->next = *to; *to = from; from = nextpl; } } /* Delete every plink on the list */ void Plink_delete(plp) struct plink *plp; { struct plink *nextpl; while( plp ){ nextpl = plp->next; plp->next = plink_freelist; plink_freelist = plp; plp = nextpl; } } /*********************** From the file "report.c" **************************/ /* ** Procedures for generating reports and tables in the LEMON parser generator. */ /* Generate a filename with the given suffix. Space to hold the ** name comes from malloc() and must be freed by the calling ** function. */ PRIVATE char *file_makename(lemp,suffix) struct lemon *lemp; char *suffix; { char *name; char *cp; name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); if( name==0 ){ fprintf(stderr,"Can't allocate space for a filename.\n"); exit(1); } strcpy(name,lemp->filename); cp = strrchr(name,'.'); if( cp ) *cp = 0; strcat(name,suffix); return name; } /* Open a file with a name based on the name of the input file, ** but with a different (specified) suffix, and return a pointer ** to the stream */ PRIVATE FILE *file_open(lemp,suffix,mode) struct lemon *lemp; char *suffix; char *mode; { FILE *fp; if( lemp->outname ) free(lemp->outname); lemp->outname = file_makename(lemp, suffix); fp = fopen(lemp->outname,mode); if( fp==0 && *mode=='w' ){ fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); lemp->errorcnt++; return 0; } return fp; } /* Duplicate the input file without comments and without actions ** on rules */ void Reprint(lemp) struct lemon *lemp; { struct rule *rp; struct symbol *sp; int i, j, maxlen, len, ncolumns, skip; printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); maxlen = 10; for(i=0; insymbol; i++){ sp = lemp->symbols[i]; len = strlen(sp->name); if( len>maxlen ) maxlen = len; } ncolumns = 76/(maxlen+5); if( ncolumns<1 ) ncolumns = 1; skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; for(i=0; insymbol; j+=skip){ sp = lemp->symbols[j]; assert( sp->index==j ); printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); } printf("\n"); } for(rp=lemp->rule; rp; rp=rp->next){ printf("%s",rp->lhs->name); /* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ printf(" ::="); for(i=0; inrhs; i++){ printf(" %s",rp->rhs[i]->name); /* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ } printf("."); if( rp->precsym ) printf(" [%s]",rp->precsym->name); /* if( rp->code ) printf("\n %s",rp->code); */ printf("\n"); } } void ConfigPrint(fp,cfp) FILE *fp; struct config *cfp; { struct rule *rp; int i; rp = cfp->rp; fprintf(fp,"%s ::=",rp->lhs->name); for(i=0; i<=rp->nrhs; i++){ if( i==cfp->dot ) fprintf(fp," *"); if( i==rp->nrhs ) break; fprintf(fp," %s",rp->rhs[i]->name); } } /* #define TEST */ #ifdef TEST /* Print a set */ PRIVATE void SetPrint(out,set,lemp) FILE *out; char *set; struct lemon *lemp; { int i; char *spacer; spacer = ""; fprintf(out,"%12s[",""); for(i=0; interminal; i++){ if( SetFind(set,i) ){ fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); spacer = " "; } } fprintf(out,"]\n"); } /* Print a plink chain */ PRIVATE void PlinkPrint(out,plp,tag) FILE *out; struct plink *plp; char *tag; { while( plp ){ fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); ConfigPrint(out,plp->cfp); fprintf(out,"\n"); plp = plp->next; } } #endif /* Print an action to the given file descriptor. Return FALSE if ** nothing was actually printed. */ int PrintAction(struct action *ap, FILE *fp, int indent){ int result = 1; switch( ap->type ){ case SHIFT: fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); break; case REDUCE: fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); break; case ACCEPT: fprintf(fp,"%*s accept",indent,ap->sp->name); break; case ERROR: fprintf(fp,"%*s error",indent,ap->sp->name); break; case CONFLICT: fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", indent,ap->sp->name,ap->x.rp->index); break; case SH_RESOLVED: case RD_RESOLVED: case NOT_USED: result = 0; break; } return result; } /* Generate the "y.output" log file */ void ReportOutput(lemp) struct lemon *lemp; { int i; struct state *stp; struct config *cfp; struct action *ap; FILE *fp; fp = file_open(lemp,".out","w"); if( fp==0 ) return; fprintf(fp," \b"); for(i=0; instate; i++){ stp = lemp->sorted[i]; fprintf(fp,"State %d:\n",stp->index); if( lemp->basisflag ) cfp=stp->bp; else cfp=stp->cfp; while( cfp ){ char buf[20]; if( cfp->dot==cfp->rp->nrhs ){ sprintf(buf,"(%d)",cfp->rp->index); fprintf(fp," %5s ",buf); }else{ fprintf(fp," "); } ConfigPrint(fp,cfp); fprintf(fp,"\n"); #ifdef TEST SetPrint(fp,cfp->fws,lemp); PlinkPrint(fp,cfp->fplp,"To "); PlinkPrint(fp,cfp->bplp,"From"); #endif if( lemp->basisflag ) cfp=cfp->bp; else cfp=cfp->next; } fprintf(fp,"\n"); for(ap=stp->ap; ap; ap=ap->next){ if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); } fprintf(fp,"\n"); } fclose(fp); return; } /* Search for the file "name" which is in the same directory as ** the exacutable */ PRIVATE char *pathsearch(argv0,name,modemask) char *argv0; char *name; int modemask; { char *pathlist; char *path,*cp; char c; extern int access(); #ifdef __WIN32__ cp = strrchr(argv0,'\\'); #else cp = strrchr(argv0,'/'); #endif if( cp ){ c = *cp; *cp = 0; path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); if( path ) sprintf(path,"%s/%s",argv0,name); *cp = c; }else{ extern char *getenv(); pathlist = getenv("PATH"); if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); if( path!=0 ){ while( *pathlist ){ cp = strchr(pathlist,':'); if( cp==0 ) cp = &pathlist[strlen(pathlist)]; c = *cp; *cp = 0; sprintf(path,"%s/%s",pathlist,name); *cp = c; if( c==0 ) pathlist = ""; else pathlist = &cp[1]; if( access(path,modemask)==0 ) break; } } } return path; } /* Given an action, compute the integer value for that action ** which is to be put in the action table of the generated machine. ** Return negative if no action should be generated. */ PRIVATE int compute_action(lemp,ap) struct lemon *lemp; struct action *ap; { int act; switch( ap->type ){ case SHIFT: act = ap->x.stp->index; break; case REDUCE: act = ap->x.rp->index + lemp->nstate; break; case ERROR: act = lemp->nstate + lemp->nrule; break; case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; default: act = -1; break; } return act; } #define LINESIZE 1000 /* The next cluster of routines are for reading the template file ** and writing the results to the generated parser */ /* The first function transfers data from "in" to "out" until ** a line is seen which begins with "%%". The line number is ** tracked. ** ** if name!=0, then any word that begin with "Parse" is changed to ** begin with *name instead. */ PRIVATE void tplt_xfer(name,in,out,lineno) char *name; FILE *in; FILE *out; int *lineno; { int i, iStart; char line[LINESIZE]; while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ (*lineno)++; iStart = 0; if( name ){ for(i=0; line[i]; i++){ if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 && (i==0 || !isalpha(line[i-1])) ){ if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); fprintf(out,"%s",name); i += 4; iStart = i+1; } } } fprintf(out,"%s",&line[iStart]); } } /* The next function finds the template file and opens it, returning ** a pointer to the opened file. */ PRIVATE FILE *tplt_open(lemp) struct lemon *lemp; { static char templatename[] = "lempar.c"; char buf[1000]; FILE *in; char *tpltname; char *cp; cp = strrchr(lemp->filename,'.'); if( cp ){ sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); }else{ sprintf(buf,"%s.lt",lemp->filename); } if( access(buf,004)==0 ){ tpltname = buf; }else if( access(templatename,004)==0 ){ tpltname = templatename; }else{ tpltname = pathsearch(lemp->argv0,templatename,0); } if( tpltname==0 ){ fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", templatename); lemp->errorcnt++; return 0; } in = fopen(tpltname,"r"); if( in==0 ){ fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); lemp->errorcnt++; return 0; } return in; } /* Print a string to the file and keep the linenumber up to date */ PRIVATE void tplt_print(out,lemp,str,strln,lineno) FILE *out; struct lemon *lemp; char *str; int strln; int *lineno; { if( str==0 ) return; fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; while( *str ){ if( *str=='\n' ) (*lineno)++; putc(*str,out); str++; } fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; return; } /* ** The following routine emits code for the destructor for the ** symbol sp */ void emit_destructor_code(out,sp,lemp,lineno) FILE *out; struct symbol *sp; struct lemon *lemp; int *lineno; { char *cp = 0; int linecnt = 0; if( sp->type==TERMINAL ){ cp = lemp->tokendest; if( cp==0 ) return; fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); }else if( sp->destructor ){ cp = sp->destructor; fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); }else if( lemp->vardest ){ cp = lemp->vardest; if( cp==0 ) return; fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); }else{ assert( 0 ); /* Cannot happen */ } for(; *cp; cp++){ if( *cp=='$' && cp[1]=='$' ){ fprintf(out,"(yypminor->yy%d)",sp->dtnum); cp++; continue; } if( *cp=='\n' ) linecnt++; fputc(*cp,out); } (*lineno) += 3 + linecnt; fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); return; } /* ** Return TRUE (non-zero) if the given symbol has a destructor. */ int has_destructor(sp, lemp) struct symbol *sp; struct lemon *lemp; { int ret; if( sp->type==TERMINAL ){ ret = lemp->tokendest!=0; }else{ ret = lemp->vardest!=0 || sp->destructor!=0; } return ret; } /* ** Generate code which executes when the rule "rp" is reduced. Write ** the code to "out". Make sure lineno stays up-to-date. */ PRIVATE void emit_code(out,rp,lemp,lineno) FILE *out; struct rule *rp; struct lemon *lemp; int *lineno; { char *cp, *xp; int linecnt = 0; int i; char lhsused = 0; /* True if the LHS element has been used */ char used[MAXRHS]; /* True for each RHS element which is used */ for(i=0; inrhs; i++) used[i] = 0; lhsused = 0; /* Generate code to do the reduce action */ if( rp->code ){ fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); for(cp=rp->code; *cp; cp++){ if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ char saved; for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); saved = *xp; *xp = 0; if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ fprintf(out,"yygotominor.yy%d",rp->lhs->dtnum); cp = xp; lhsused = 1; }else{ for(i=0; inrhs; i++){ if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ fprintf(out,"yymsp[%d].minor.yy%d",i-rp->nrhs+1,rp->rhs[i]->dtnum); cp = xp; used[i] = 1; break; } } } *xp = saved; } if( *cp=='\n' ) linecnt++; fputc(*cp,out); } /* End loop */ (*lineno) += 3 + linecnt; fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); } /* End if( rp->code ) */ /* Check to make sure the LHS has been used */ if( rp->lhsalias && !lhsused ){ ErrorMsg(lemp->filename,rp->ruleline, "Label \"%s\" for \"%s(%s)\" is never used.", rp->lhsalias,rp->lhs->name,rp->lhsalias); lemp->errorcnt++; } /* Generate destructor code for RHS symbols which are not used in the ** reduce code */ for(i=0; inrhs; i++){ if( rp->rhsalias[i] && !used[i] ){ ErrorMsg(lemp->filename,rp->ruleline, "Label %s for \"%s(%s)\" is never used.", rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); lemp->errorcnt++; }else if( rp->rhsalias[i]==0 ){ if( has_destructor(rp->rhs[i],lemp) ){ fprintf(out," yy_destructor(%d,&yymsp[%d].minor);\n", rp->rhs[i]->index,i-rp->nrhs+1); (*lineno)++; }else{ fprintf(out," /* No destructor defined for %s */\n", rp->rhs[i]->name); (*lineno)++; } } } return; } /* ** Print the definition of the union used for the parser's data stack. ** This union contains fields for every possible data type for tokens ** and nonterminals. In the process of computing and printing this ** union, also set the ".dtnum" field of every terminal and nonterminal ** symbol. */ void print_stack_union(out,lemp,plineno,mhflag) FILE *out; /* The output stream */ struct lemon *lemp; /* The main info structure for this parser */ int *plineno; /* Pointer to the line number */ int mhflag; /* True if generating makeheaders output */ { int lineno = *plineno; /* The line number of the output */ char **types; /* A hash table of datatypes */ int arraysize; /* Size of the "types" array */ int maxdtlength; /* Maximum length of any ".datatype" field. */ char *stddt; /* Standardized name for a datatype */ int i,j; /* Loop counters */ int hash; /* For hashing the name of a type */ char *name; /* Name of the parser */ /* Allocate and initialize types[] and allocate stddt[] */ arraysize = lemp->nsymbol * 2; types = (char**)malloc( arraysize * sizeof(char*) ); for(i=0; ivartype ){ maxdtlength = strlen(lemp->vartype); } for(i=0; insymbol; i++){ int len; struct symbol *sp = lemp->symbols[i]; if( sp->datatype==0 ) continue; len = strlen(sp->datatype); if( len>maxdtlength ) maxdtlength = len; } stddt = (char*)malloc( maxdtlength*2 + 1 ); if( types==0 || stddt==0 ){ fprintf(stderr,"Out of memory.\n"); exit(1); } /* Build a hash table of datatypes. The ".dtnum" field of each symbol ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is ** used for terminal symbols. If there is no %default_type defined then ** 0 is also used as the .dtnum value for nonterminals which do not specify ** a datatype using the %type directive. */ for(i=0; insymbol; i++){ struct symbol *sp = lemp->symbols[i]; char *cp; if( sp==lemp->errsym ){ sp->dtnum = arraysize+1; continue; } if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ sp->dtnum = 0; continue; } cp = sp->datatype; if( cp==0 ) cp = lemp->vartype; j = 0; while( isspace(*cp) ) cp++; while( *cp ) stddt[j++] = *cp++; while( j>0 && isspace(stddt[j-1]) ) j--; stddt[j] = 0; hash = 0; for(j=0; stddt[j]; j++){ hash = hash*53 + stddt[j]; } hash = (hash & 0x7fffffff)%arraysize; while( types[hash] ){ if( strcmp(types[hash],stddt)==0 ){ sp->dtnum = hash + 1; break; } hash++; if( hash>=arraysize ) hash = 0; } if( types[hash]==0 ){ sp->dtnum = hash + 1; types[hash] = (char*)malloc( strlen(stddt)+1 ); if( types[hash]==0 ){ fprintf(stderr,"Out of memory.\n"); exit(1); } strcpy(types[hash],stddt); } } /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ name = lemp->name ? lemp->name : "Parse"; lineno = *plineno; if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } fprintf(out,"#define %sTOKENTYPE %s\n",name, lemp->tokentype?lemp->tokentype:"void*"); lineno++; if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } fprintf(out,"typedef union {\n"); lineno++; fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; for(i=0; ierrsym->dtnum); lineno++; free(stddt); free(types); fprintf(out,"} YYMINORTYPE;\n"); lineno++; *plineno = lineno; } /* ** Return the name of a C datatype able to represent values between ** lwr and upr, inclusive. */ static const char *minimum_size_type(int lwr, int upr){ if( lwr>=0 ){ if( upr<=255 ){ return "unsigned char"; }else if( upr<65535 ){ return "unsigned short int"; }else{ return "unsigned int"; } }else if( lwr>=-127 && upr<=127 ){ return "signed char"; }else if( lwr>=-32767 && upr<32767 ){ return "short"; }else{ return "int"; } } /* ** Each state contains a set of token transaction and a set of ** nonterminal transactions. Each of these sets makes an instance ** of the following structure. An array of these structures is used ** to order the creation of entries in the yy_action[] table. */ struct axset { struct state *stp; /* A pointer to a state */ int isTkn; /* True to use tokens. False for non-terminals */ int nAction; /* Number of actions */ }; /* ** Compare to axset structures for sorting purposes */ static int axset_compare(const void *a, const void *b){ struct axset *p1 = (struct axset*)a; struct axset *p2 = (struct axset*)b; return p2->nAction - p1->nAction; } /* Generate C source code for the parser */ void ReportTable(lemp, mhflag) struct lemon *lemp; int mhflag; /* Output in makeheaders format if true */ { FILE *out, *in; char line[LINESIZE]; int lineno; struct state *stp; struct action *ap; struct rule *rp; struct acttab *pActtab; int i, j, n; char *name; int mnTknOfst, mxTknOfst; int mnNtOfst, mxNtOfst; struct axset *ax; in = tplt_open(lemp); if( in==0 ) return; out = file_open(lemp,".c","w"); if( out==0 ){ fclose(in); return; } lineno = 1; tplt_xfer(lemp->name,in,out,&lineno); /* Generate the include code, if any */ tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); if( mhflag ){ char *name = file_makename(lemp, ".h"); fprintf(out,"#include \"%s\"\n", name); lineno++; free(name); } tplt_xfer(lemp->name,in,out,&lineno); /* Generate #defines for all tokens */ if( mhflag ){ char *prefix; fprintf(out,"#if INTERFACE\n"); lineno++; if( lemp->tokenprefix ) prefix = lemp->tokenprefix; else prefix = ""; for(i=1; interminal; i++){ fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); lineno++; } fprintf(out,"#endif\n"); lineno++; } tplt_xfer(lemp->name,in,out,&lineno); /* Generate the defines */ fprintf(out,"/* \001 */\n"); fprintf(out,"#define YYCODETYPE %s\n", minimum_size_type(0, lemp->nsymbol+5)); lineno++; fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; fprintf(out,"#define YYACTIONTYPE %s\n", minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; print_stack_union(out,lemp,&lineno,mhflag); if( lemp->stacksize ){ if( atoi(lemp->stacksize)<=0 ){ ErrorMsg(lemp->filename,0, "Illegal stack size: [%s]. The stack size should be an integer constant.", lemp->stacksize); lemp->errorcnt++; lemp->stacksize = "100"; } fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; }else{ fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; } if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } name = lemp->name ? lemp->name : "Parse"; if( lemp->arg && lemp->arg[0] ){ int i; i = strlen(lemp->arg); while( i>=1 && isspace(lemp->arg[i-1]) ) i--; while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", name,lemp->arg,&lemp->arg[i]); lineno++; fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", name,&lemp->arg[i],&lemp->arg[i]); lineno++; }else{ fprintf(out,"#define %sARG_SDECL\n",name); lineno++; fprintf(out,"#define %sARG_PDECL\n",name); lineno++; fprintf(out,"#define %sARG_FETCH\n",name); lineno++; fprintf(out,"#define %sARG_STORE\n",name); lineno++; } if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; if( lemp->has_fallback ){ fprintf(out,"#define YYFALLBACK 1\n"); lineno++; } tplt_xfer(lemp->name,in,out,&lineno); /* Generate the action table and its associates: ** ** yy_action[] A single table containing all actions. ** yy_lookahead[] A table containing the lookahead for each entry in ** yy_action. Used to detect hash collisions. ** yy_shift_ofst[] For each state, the offset into yy_action for ** shifting terminals. ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. */ /* Compute the actions on all states and count them up */ ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); if( ax==0 ){ fprintf(stderr,"malloc failed\n"); exit(1); } for(i=0; instate; i++){ stp = lemp->sorted[i]; stp->nTknAct = stp->nNtAct = 0; stp->iDflt = lemp->nstate + lemp->nrule; stp->iTknOfst = NO_OFFSET; stp->iNtOfst = NO_OFFSET; for(ap=stp->ap; ap; ap=ap->next){ if( compute_action(lemp,ap)>=0 ){ if( ap->sp->indexnterminal ){ stp->nTknAct++; }else if( ap->sp->indexnsymbol ){ stp->nNtAct++; }else{ stp->iDflt = compute_action(lemp, ap); } } } ax[i*2].stp = stp; ax[i*2].isTkn = 1; ax[i*2].nAction = stp->nTknAct; ax[i*2+1].stp = stp; ax[i*2+1].isTkn = 0; ax[i*2+1].nAction = stp->nNtAct; } mxTknOfst = mnTknOfst = 0; mxNtOfst = mnNtOfst = 0; /* Compute the action table. In order to try to keep the size of the ** action table to a minimum, the heuristic of placing the largest action ** sets first is used. */ qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); pActtab = acttab_alloc(); for(i=0; instate*2 && ax[i].nAction>0; i++){ stp = ax[i].stp; if( ax[i].isTkn ){ for(ap=stp->ap; ap; ap=ap->next){ int action; if( ap->sp->index>=lemp->nterminal ) continue; action = compute_action(lemp, ap); if( action<0 ) continue; acttab_action(pActtab, ap->sp->index, action); } stp->iTknOfst = acttab_insert(pActtab); if( stp->iTknOfstiTknOfst; if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; }else{ for(ap=stp->ap; ap; ap=ap->next){ int action; if( ap->sp->indexnterminal ) continue; if( ap->sp->index==lemp->nsymbol ) continue; action = compute_action(lemp, ap); if( action<0 ) continue; acttab_action(pActtab, ap->sp->index, action); } stp->iNtOfst = acttab_insert(pActtab); if( stp->iNtOfstiNtOfst; if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; } } free(ax); /* Output the yy_action table */ fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; n = acttab_size(pActtab); for(i=j=0; insymbol + lemp->nrule + 2; if( j==0 ) fprintf(out," /* %5d */ ", i); fprintf(out, " %4d,", action); if( j==9 || i==n-1 ){ fprintf(out, "\n"); lineno++; j = 0; }else{ j++; } } fprintf(out, "};\n"); lineno++; /* Output the yy_lookahead table */ fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; for(i=j=0; insymbol; if( j==0 ) fprintf(out," /* %5d */ ", i); fprintf(out, " %4d,", la); if( j==9 || i==n-1 ){ fprintf(out, "\n"); lineno++; j = 0; }else{ j++; } } fprintf(out, "};\n"); lineno++; /* Output the yy_shift_ofst[] table */ fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; fprintf(out, "static %s yy_shift_ofst[] = {\n", minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; n = lemp->nstate; for(i=j=0; isorted[i]; ofst = stp->iTknOfst; if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; if( j==0 ) fprintf(out," /* %5d */ ", i); fprintf(out, " %4d,", ofst); if( j==9 || i==n-1 ){ fprintf(out, "\n"); lineno++; j = 0; }else{ j++; } } fprintf(out, "};\n"); lineno++; /* Output the yy_reduce_ofst[] table */ fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; fprintf(out, "static %s yy_reduce_ofst[] = {\n", minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; n = lemp->nstate; for(i=j=0; isorted[i]; ofst = stp->iNtOfst; if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; if( j==0 ) fprintf(out," /* %5d */ ", i); fprintf(out, " %4d,", ofst); if( j==9 || i==n-1 ){ fprintf(out, "\n"); lineno++; j = 0; }else{ j++; } } fprintf(out, "};\n"); lineno++; /* Output the default action table */ fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; n = lemp->nstate; for(i=j=0; isorted[i]; if( j==0 ) fprintf(out," /* %5d */ ", i); fprintf(out, " %4d,", stp->iDflt); if( j==9 || i==n-1 ){ fprintf(out, "\n"); lineno++; j = 0; }else{ j++; } } fprintf(out, "};\n"); lineno++; tplt_xfer(lemp->name,in,out,&lineno); /* Generate the table of fallback tokens. */ if( lemp->has_fallback ){ for(i=0; interminal; i++){ struct symbol *p = lemp->symbols[i]; if( p->fallback==0 ){ fprintf(out, " 0, /* %10s => nothing */\n", p->name); }else{ fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, p->name, p->fallback->name); } lineno++; } } tplt_xfer(lemp->name, in, out, &lineno); /* Generate a table containing the symbolic name of every symbol */ for(i=0; insymbol; i++){ sprintf(line,"\"%s\",",lemp->symbols[i]->name); fprintf(out," %-15s",line); if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } } if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } tplt_xfer(lemp->name,in,out,&lineno); /* Generate a table containing a text string that describes every ** rule in the rule set of the grammer. This information is used ** when tracing REDUCE actions. */ for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ assert( rp->index==i ); fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); fprintf(out,"\",\n"); lineno++; } tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which executes every time a symbol is popped from ** the stack while processing errors or while destroying the parser. ** (In other words, generate the %destructor actions) */ if( lemp->tokendest ){ for(i=0; insymbol; i++){ struct symbol *sp = lemp->symbols[i]; if( sp==0 || sp->type!=TERMINAL ) continue; fprintf(out," case %d:\n",sp->index); lineno++; } for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); if( insymbol ){ emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); fprintf(out," break;\n"); lineno++; } } for(i=0; insymbol; i++){ struct symbol *sp = lemp->symbols[i]; if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; fprintf(out," case %d:\n",sp->index); lineno++; emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); fprintf(out," break;\n"); lineno++; } if( lemp->vardest ){ struct symbol *dflt_sp = 0; for(i=0; insymbol; i++){ struct symbol *sp = lemp->symbols[i]; if( sp==0 || sp->type==TERMINAL || sp->index<=0 || sp->destructor!=0 ) continue; fprintf(out," case %d:\n",sp->index); lineno++; dflt_sp = sp; } if( dflt_sp!=0 ){ emit_destructor_code(out,dflt_sp,lemp,&lineno); fprintf(out," break;\n"); lineno++; } } tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which executes whenever the parser stack overflows */ tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); tplt_xfer(lemp->name,in,out,&lineno); /* Generate the table of rule information ** ** Note: This code depends on the fact that rules are number ** sequentually beginning with 0. */ for(rp=lemp->rule; rp; rp=rp->next){ fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; } tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which execution during each REDUCE action */ for(rp=lemp->rule; rp; rp=rp->next){ fprintf(out," case %d:\n",rp->index); lineno++; emit_code(out,rp,lemp,&lineno); fprintf(out," break;\n"); lineno++; } tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which executes if a parse fails */ tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which executes when a syntax error occurs */ tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which executes when the parser accepts its input */ tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); tplt_xfer(lemp->name,in,out,&lineno); /* Append any addition code the user desires */ tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); fclose(in); fclose(out); return; } /* Generate a header file for the parser */ void ReportHeader(lemp) struct lemon *lemp; { FILE *out, *in; char *prefix; char line[LINESIZE]; char pattern[LINESIZE]; int i; if( lemp->tokenprefix ) prefix = lemp->tokenprefix; else prefix = ""; in = file_open(lemp,".h","r"); if( in ){ for(i=1; interminal && fgets(line,LINESIZE,in); i++){ sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); if( strcmp(line,pattern) ) break; } fclose(in); if( i==lemp->nterminal ){ /* No change in the file. Don't rewrite it. */ return; } } out = file_open(lemp,".h","w"); if( out ){ for(i=1; interminal; i++){ fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); } fclose(out); } return; } /* Reduce the size of the action tables, if possible, by making use ** of defaults. ** ** In this version, we take the most frequent REDUCE action and make ** it the default. Only default a reduce if there are more than one. */ void CompressTables(lemp) struct lemon *lemp; { struct state *stp; struct action *ap, *ap2; struct rule *rp, *rp2, *rbest; int nbest, n; int i; for(i=0; instate; i++){ stp = lemp->sorted[i]; nbest = 0; rbest = 0; for(ap=stp->ap; ap; ap=ap->next){ if( ap->type!=REDUCE ) continue; rp = ap->x.rp; if( rp==rbest ) continue; n = 1; for(ap2=ap->next; ap2; ap2=ap2->next){ if( ap2->type!=REDUCE ) continue; rp2 = ap2->x.rp; if( rp2==rbest ) continue; if( rp2==rp ) n++; } if( n>nbest ){ nbest = n; rbest = rp; } } /* Do not make a default if the number of rules to default ** is not at least 2 */ if( nbest<2 ) continue; /* Combine matching REDUCE actions into a single default */ for(ap=stp->ap; ap; ap=ap->next){ if( ap->type==REDUCE && ap->x.rp==rbest ) break; } assert( ap ); ap->sp = Symbol_new("{default}"); for(ap=ap->next; ap; ap=ap->next){ if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; } stp->ap = Action_sort(stp->ap); } } /***************** From the file "set.c" ************************************/ /* ** Set manipulation routines for the LEMON parser generator. */ static int size = 0; /* Set the set size */ void SetSize(n) int n; { size = n+1; } /* Allocate a new set */ char *SetNew(){ char *s; int i; s = (char*)malloc( size ); if( s==0 ){ extern void memory_error(); memory_error(); } for(i=0; isize = 1024; x1a->count = 0; x1a->tbl = (x1node*)malloc( (sizeof(x1node) + sizeof(x1node*))*1024 ); if( x1a->tbl==0 ){ free(x1a); x1a = 0; }else{ int i; x1a->ht = (x1node**)&(x1a->tbl[1024]); for(i=0; i<1024; i++) x1a->ht[i] = 0; } } } /* Insert a new record into the array. Return TRUE if successful. ** Prior data with the same key is NOT overwritten */ int Strsafe_insert(data) char *data; { x1node *np; int h; int ph; if( x1a==0 ) return 0; ph = strhash(data); h = ph & (x1a->size-1); np = x1a->ht[h]; while( np ){ if( strcmp(np->data,data)==0 ){ /* An existing entry with the same key is found. */ /* Fail because overwrite is not allows. */ return 0; } np = np->next; } if( x1a->count>=x1a->size ){ /* Need to make the hash table bigger */ int i,size; struct s_x1 array; array.size = size = x1a->size*2; array.count = x1a->count; array.tbl = (x1node*)malloc( (sizeof(x1node) + sizeof(x1node*))*size ); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ array.ht = (x1node**)&(array.tbl[size]); for(i=0; icount; i++){ x1node *oldnp, *newnp; oldnp = &(x1a->tbl[i]); h = strhash(oldnp->data) & (size-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->data = oldnp->data; newnp->from = &(array.ht[h]); array.ht[h] = newnp; } free(x1a->tbl); *x1a = array; } /* Insert the new data */ h = ph & (x1a->size-1); np = &(x1a->tbl[x1a->count++]); np->data = data; if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); np->next = x1a->ht[h]; x1a->ht[h] = np; np->from = &(x1a->ht[h]); return 1; } /* Return a pointer to data assigned to the given key. Return NULL ** if no such key. */ char *Strsafe_find(key) char *key; { int h; x1node *np; if( x1a==0 ) return 0; h = strhash(key) & (x1a->size-1); np = x1a->ht[h]; while( np ){ if( strcmp(np->data,key)==0 ) break; np = np->next; } return np ? np->data : 0; } /* Return a pointer to the (terminal or nonterminal) symbol "x". ** Create a new symbol if this is the first time "x" has been seen. */ struct symbol *Symbol_new(x) char *x; { struct symbol *sp; sp = Symbol_find(x); if( sp==0 ){ sp = (struct symbol *)malloc( sizeof(struct symbol) ); MemoryCheck(sp); sp->name = Strsafe(x); sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; sp->rule = 0; sp->fallback = 0; sp->prec = -1; sp->assoc = UNK; sp->firstset = 0; sp->lambda = B_FALSE; sp->destructor = 0; sp->datatype = 0; Symbol_insert(sp,sp->name); } return sp; } /* Compare two symbols for working purposes ** ** Symbols that begin with upper case letters (terminals or tokens) ** must sort before symbols that begin with lower case letters ** (non-terminals). Other than that, the order does not matter. ** ** We find experimentally that leaving the symbols in their original ** order (the order they appeared in the grammar file) gives the ** smallest parser tables in SQLite. */ int Symbolcmpp(struct symbol **a, struct symbol **b){ int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); return i1-i2; } /* There is one instance of the following structure for each ** associative array of type "x2". */ struct s_x2 { int size; /* The number of available slots. */ /* Must be a power of 2 greater than or */ /* equal to 1 */ int count; /* Number of currently slots filled */ struct s_x2node *tbl; /* The data stored here */ struct s_x2node **ht; /* Hash table for lookups */ }; /* There is one instance of this structure for every data element ** in an associative array of type "x2". */ typedef struct s_x2node { struct symbol *data; /* The data */ char *key; /* The key */ struct s_x2node *next; /* Next entry with the same hash */ struct s_x2node **from; /* Previous link */ } x2node; /* There is only one instance of the array, which is the following */ static struct s_x2 *x2a; /* Allocate a new associative array */ void Symbol_init(){ if( x2a ) return; x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); if( x2a ){ x2a->size = 128; x2a->count = 0; x2a->tbl = (x2node*)malloc( (sizeof(x2node) + sizeof(x2node*))*128 ); if( x2a->tbl==0 ){ free(x2a); x2a = 0; }else{ int i; x2a->ht = (x2node**)&(x2a->tbl[128]); for(i=0; i<128; i++) x2a->ht[i] = 0; } } } /* Insert a new record into the array. Return TRUE if successful. ** Prior data with the same key is NOT overwritten */ int Symbol_insert(data,key) struct symbol *data; char *key; { x2node *np; int h; int ph; if( x2a==0 ) return 0; ph = strhash(key); h = ph & (x2a->size-1); np = x2a->ht[h]; while( np ){ if( strcmp(np->key,key)==0 ){ /* An existing entry with the same key is found. */ /* Fail because overwrite is not allows. */ return 0; } np = np->next; } if( x2a->count>=x2a->size ){ /* Need to make the hash table bigger */ int i,size; struct s_x2 array; array.size = size = x2a->size*2; array.count = x2a->count; array.tbl = (x2node*)malloc( (sizeof(x2node) + sizeof(x2node*))*size ); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ array.ht = (x2node**)&(array.tbl[size]); for(i=0; icount; i++){ x2node *oldnp, *newnp; oldnp = &(x2a->tbl[i]); h = strhash(oldnp->key) & (size-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->key = oldnp->key; newnp->data = oldnp->data; newnp->from = &(array.ht[h]); array.ht[h] = newnp; } free(x2a->tbl); *x2a = array; } /* Insert the new data */ h = ph & (x2a->size-1); np = &(x2a->tbl[x2a->count++]); np->key = key; np->data = data; if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); np->next = x2a->ht[h]; x2a->ht[h] = np; np->from = &(x2a->ht[h]); return 1; } /* Return a pointer to data assigned to the given key. Return NULL ** if no such key. */ struct symbol *Symbol_find(key) char *key; { int h; x2node *np; if( x2a==0 ) return 0; h = strhash(key) & (x2a->size-1); np = x2a->ht[h]; while( np ){ if( strcmp(np->key,key)==0 ) break; np = np->next; } return np ? np->data : 0; } /* Return the n-th data. Return NULL if n is out of range. */ struct symbol *Symbol_Nth(n) int n; { struct symbol *data; if( x2a && n>0 && n<=x2a->count ){ data = x2a->tbl[n-1].data; }else{ data = 0; } return data; } /* Return the size of the array */ int Symbol_count() { return x2a ? x2a->count : 0; } /* Return an array of pointers to all data in the table. ** The array is obtained from malloc. Return NULL if memory allocation ** problems, or if the array is empty. */ struct symbol **Symbol_arrayof() { struct symbol **array; int i,size; if( x2a==0 ) return 0; size = x2a->count; array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); if( array ){ for(i=0; itbl[i].data; } return array; } /* Compare two configurations */ int Configcmp(a,b) struct config *a; struct config *b; { int x; x = a->rp->index - b->rp->index; if( x==0 ) x = a->dot - b->dot; return x; } /* Compare two states */ PRIVATE int statecmp(a,b) struct config *a; struct config *b; { int rc; for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ rc = a->rp->index - b->rp->index; if( rc==0 ) rc = a->dot - b->dot; } if( rc==0 ){ if( a ) rc = 1; if( b ) rc = -1; } return rc; } /* Hash a state */ PRIVATE int statehash(a) struct config *a; { int h=0; while( a ){ h = h*571 + a->rp->index*37 + a->dot; a = a->bp; } return h; } /* Allocate a new state structure */ struct state *State_new() { struct state *new; new = (struct state *)malloc( sizeof(struct state) ); MemoryCheck(new); return new; } /* There is one instance of the following structure for each ** associative array of type "x3". */ struct s_x3 { int size; /* The number of available slots. */ /* Must be a power of 2 greater than or */ /* equal to 1 */ int count; /* Number of currently slots filled */ struct s_x3node *tbl; /* The data stored here */ struct s_x3node **ht; /* Hash table for lookups */ }; /* There is one instance of this structure for every data element ** in an associative array of type "x3". */ typedef struct s_x3node { struct state *data; /* The data */ struct config *key; /* The key */ struct s_x3node *next; /* Next entry with the same hash */ struct s_x3node **from; /* Previous link */ } x3node; /* There is only one instance of the array, which is the following */ static struct s_x3 *x3a; /* Allocate a new associative array */ void State_init(){ if( x3a ) return; x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); if( x3a ){ x3a->size = 128; x3a->count = 0; x3a->tbl = (x3node*)malloc( (sizeof(x3node) + sizeof(x3node*))*128 ); if( x3a->tbl==0 ){ free(x3a); x3a = 0; }else{ int i; x3a->ht = (x3node**)&(x3a->tbl[128]); for(i=0; i<128; i++) x3a->ht[i] = 0; } } } /* Insert a new record into the array. Return TRUE if successful. ** Prior data with the same key is NOT overwritten */ int State_insert(data,key) struct state *data; struct config *key; { x3node *np; int h; int ph; if( x3a==0 ) return 0; ph = statehash(key); h = ph & (x3a->size-1); np = x3a->ht[h]; while( np ){ if( statecmp(np->key,key)==0 ){ /* An existing entry with the same key is found. */ /* Fail because overwrite is not allows. */ return 0; } np = np->next; } if( x3a->count>=x3a->size ){ /* Need to make the hash table bigger */ int i,size; struct s_x3 array; array.size = size = x3a->size*2; array.count = x3a->count; array.tbl = (x3node*)malloc( (sizeof(x3node) + sizeof(x3node*))*size ); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ array.ht = (x3node**)&(array.tbl[size]); for(i=0; icount; i++){ x3node *oldnp, *newnp; oldnp = &(x3a->tbl[i]); h = statehash(oldnp->key) & (size-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->key = oldnp->key; newnp->data = oldnp->data; newnp->from = &(array.ht[h]); array.ht[h] = newnp; } free(x3a->tbl); *x3a = array; } /* Insert the new data */ h = ph & (x3a->size-1); np = &(x3a->tbl[x3a->count++]); np->key = key; np->data = data; if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); np->next = x3a->ht[h]; x3a->ht[h] = np; np->from = &(x3a->ht[h]); return 1; } /* Return a pointer to data assigned to the given key. Return NULL ** if no such key. */ struct state *State_find(key) struct config *key; { int h; x3node *np; if( x3a==0 ) return 0; h = statehash(key) & (x3a->size-1); np = x3a->ht[h]; while( np ){ if( statecmp(np->key,key)==0 ) break; np = np->next; } return np ? np->data : 0; } /* Return an array of pointers to all data in the table. ** The array is obtained from malloc. Return NULL if memory allocation ** problems, or if the array is empty. */ struct state **State_arrayof() { struct state **array; int i,size; if( x3a==0 ) return 0; size = x3a->count; array = (struct state **)malloc( sizeof(struct state *)*size ); if( array ){ for(i=0; itbl[i].data; } return array; } /* Hash a configuration */ PRIVATE int confighash(a) struct config *a; { int h=0; h = h*571 + a->rp->index*37 + a->dot; return h; } /* There is one instance of the following structure for each ** associative array of type "x4". */ struct s_x4 { int size; /* The number of available slots. */ /* Must be a power of 2 greater than or */ /* equal to 1 */ int count; /* Number of currently slots filled */ struct s_x4node *tbl; /* The data stored here */ struct s_x4node **ht; /* Hash table for lookups */ }; /* There is one instance of this structure for every data element ** in an associative array of type "x4". */ typedef struct s_x4node { struct config *data; /* The data */ struct s_x4node *next; /* Next entry with the same hash */ struct s_x4node **from; /* Previous link */ } x4node; /* There is only one instance of the array, which is the following */ static struct s_x4 *x4a; /* Allocate a new associative array */ void Configtable_init(){ if( x4a ) return; x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); if( x4a ){ x4a->size = 64; x4a->count = 0; x4a->tbl = (x4node*)malloc( (sizeof(x4node) + sizeof(x4node*))*64 ); if( x4a->tbl==0 ){ free(x4a); x4a = 0; }else{ int i; x4a->ht = (x4node**)&(x4a->tbl[64]); for(i=0; i<64; i++) x4a->ht[i] = 0; } } } /* Insert a new record into the array. Return TRUE if successful. ** Prior data with the same key is NOT overwritten */ int Configtable_insert(data) struct config *data; { x4node *np; int h; int ph; if( x4a==0 ) return 0; ph = confighash(data); h = ph & (x4a->size-1); np = x4a->ht[h]; while( np ){ if( Configcmp(np->data,data)==0 ){ /* An existing entry with the same key is found. */ /* Fail because overwrite is not allows. */ return 0; } np = np->next; } if( x4a->count>=x4a->size ){ /* Need to make the hash table bigger */ int i,size; struct s_x4 array; array.size = size = x4a->size*2; array.count = x4a->count; array.tbl = (x4node*)malloc( (sizeof(x4node) + sizeof(x4node*))*size ); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ array.ht = (x4node**)&(array.tbl[size]); for(i=0; icount; i++){ x4node *oldnp, *newnp; oldnp = &(x4a->tbl[i]); h = confighash(oldnp->data) & (size-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->data = oldnp->data; newnp->from = &(array.ht[h]); array.ht[h] = newnp; } free(x4a->tbl); *x4a = array; } /* Insert the new data */ h = ph & (x4a->size-1); np = &(x4a->tbl[x4a->count++]); np->data = data; if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); np->next = x4a->ht[h]; x4a->ht[h] = np; np->from = &(x4a->ht[h]); return 1; } /* Return a pointer to data assigned to the given key. Return NULL ** if no such key. */ struct config *Configtable_find(key) struct config *key; { int h; x4node *np; if( x4a==0 ) return 0; h = confighash(key) & (x4a->size-1); np = x4a->ht[h]; while( np ){ if( Configcmp(np->data,key)==0 ) break; np = np->next; } return np ? np->data : 0; } /* Remove all data from the table. Pass each data to the function "f" ** as it is removed. ("f" may be null to avoid this step.) */ void Configtable_clear(f) int(*f)(/* struct config * */); { int i; if( x4a==0 || x4a->count==0 ) return; if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); for(i=0; isize; i++) x4a->ht[i] = 0; x4a->count = 0; return; } sqlite-2.8.17/tool/lempar.c0000644000175000001440000005400210232547612015452 0ustar drhusers00000000000000/* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ #include %% /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ /* ** These constants (all generated automatically by the parser generator) ** specify the various kinds of tokens (terminals) that the parser ** understands. ** ** Each symbol here is a terminal symbol in the grammar. */ %% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE # define INTERFACE 1 #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. ** YYCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. ** YYNOCODE is a number of type YYCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. ** YYFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. ** YYACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** ParseTOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. ** YYMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is ParseTOKENTYPE. The entry in the union ** for base tokens is called "yy0". ** YYSTACKDEPTH is the maximum depth of the parser's stack. ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser ** YYNSTATE the combined number of states. ** YYNRULE the number of rules in the grammar ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ %% #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) #define YY_ERROR_ACTION (YYNSTATE+YYNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement ** functions that take a state number and lookahead value and return an ** action integer. ** ** Suppose the action integer is N. Then the action is determined as ** follows ** ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. ** ** N == YYNSTATE+YYNRULE A syntax error has occurred. ** ** N == YYNSTATE+YYNRULE+1 The parser accepts its input. ** ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused ** slots in the yy_action[] table. ** ** The action table is constructed as a single large table named yy_action[]. ** Given state S and lookahead X, the action is computed as ** ** yy_action[ yy_shift_ofst[S] + X ] ** ** If the index value yy_shift_ofst[S]+X is out of range or if the value ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table ** and that yy_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after ** a reduce action) then the yy_reduce_ofst[] array is used in place of ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of ** YY_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** ** yy_action[] A single table containing all actions. ** yy_lookahead[] A table containing the lookahead for each entry in ** yy_action. Used to detect hash collisions. ** yy_shift_ofst[] For each state, the offset into yy_action for ** shifting terminals. ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. */ %% #define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: ** ** %fallback ID X Y Z. ** ** appears in the grammer, then ID becomes a fallback token for X, Y, ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ #ifdef YYFALLBACK static const YYCODETYPE yyFallback[] = { %% }; #endif /* YYFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: ** ** + The state number for the parser at this level of the stack. ** ** + The value of the token stored at this level of the stack. ** (In other words, the "major" token.) ** ** + The semantic value stored at this level of the stack. This is ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ struct yyStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ YYMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; typedef struct yyStackEntry yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct yyParser { int yyidx; /* Index of top element in stack */ int yyerrcnt; /* Shifts left before out of the error */ ParseARG_SDECL /* A place to hold %extra_argument */ yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ }; typedef struct yyParser yyParser; #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG /* ** Turn parser tracing on by giving a stream to which to write the trace ** and a prompt to preface each trace message. Tracing is turned off ** by making either argument NULL ** ** Inputs: **
      **
    • A FILE* to which trace output should be written. ** If NULL, then tracing is turned off. **
    • A prefix string written at the beginning of every ** line of trace output. If NULL, then tracing is ** turned off. **
    ** ** Outputs: ** None. */ void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ yyTraceFILE = TraceFILE; yyTracePrompt = zTracePrompt; if( yyTraceFILE==0 ) yyTracePrompt = 0; else if( yyTracePrompt==0 ) yyTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ static const char *yyTokenName[] = { %% }; #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *yyRuleName[] = { %% }; #endif /* NDEBUG */ /* ** This function returns the symbolic name associated with a token ** value. */ const char *ParseTokenName(int tokenType){ #ifndef NDEBUG if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ return yyTokenName[tokenType]; }else{ return "Unknown"; } #else return ""; #endif } /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like ** malloc. ** ** Inputs: ** A pointer to the function used to allocate memory. ** ** Outputs: ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ void *ParseAlloc(void *(*mallocProc)(size_t)){ yyParser *pParser; pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); if( pParser ){ pParser->yyidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. ** "yymajor" is the symbol code, and "yypminor" is a pointer to ** the value. */ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a ** reduce or during error processing or when a parser is ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are not used ** inside the C code. */ %% default: break; /* If no destructor action specified: do nothing */ } } /* ** Pop the parser's stack once. ** ** If there is a destructor routine associated with the token which ** is popped from the stack, then call it. ** ** Return the major token number for the symbol popped. */ static int yy_pop_parser_stack(yyParser *pParser){ YYCODETYPE yymajor; yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; if( pParser->yyidx<0 ) return 0; #ifndef NDEBUG if( yyTraceFILE && pParser->yyidx>=0 ){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); } #endif yymajor = yytos->major; yy_destructor( yymajor, &yytos->minor); pParser->yyidx--; return yymajor; } /* ** Deallocate and destroy a parser. Destructors are all called for ** all stack elements before shutting the parser down. ** ** Inputs: **
      **
    • A pointer to the parser. This should be a pointer ** obtained from ParseAlloc. **
    • A pointer to a function used to reclaim memory obtained ** from malloc. **
    */ void ParseFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ yyParser *pParser = (yyParser*)p; if( pParser==0 ) return; while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } /* ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. ** ** If the look-ahead token is YYNOCODE, then check to see if the action is ** independent of the look-ahead. If it is, return the action, otherwise ** return YY_NO_ACTION. */ static int yy_find_shift_action( yyParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; int stateno = pParser->yystack[pParser->yyidx].stateno; /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ i = yy_shift_ofst[stateno]; if( i==YY_SHIFT_USE_DFLT ){ return yy_default[stateno]; } if( iLookAhead==YYNOCODE ){ return YY_NO_ACTION; } i += iLookAhead; if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK int iFallback; /* Fallback token */ if( iLookAhead %s\n", yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); } #endif return yy_find_shift_action(pParser, iFallback); } #endif return yy_default[stateno]; }else{ return yy_action[i]; } } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. ** ** If the look-ahead token is YYNOCODE, then check to see if the action is ** independent of the look-ahead. If it is, return the action, otherwise ** return YY_NO_ACTION. */ static int yy_find_reduce_action( yyParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; int stateno = pParser->yystack[pParser->yyidx].stateno; i = yy_reduce_ofst[stateno]; if( i==YY_REDUCE_USE_DFLT ){ return yy_default[stateno]; } if( iLookAhead==YYNOCODE ){ return YY_NO_ACTION; } i += iLookAhead; if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ return yy_default[stateno]; }else{ return yy_action[i]; } } /* ** Perform a shift action. */ static void yy_shift( yyParser *yypParser, /* The parser to be shifted */ int yyNewState, /* The new state to shift in */ int yyMajor, /* The major token to shift in */ YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ ){ yyStackEntry *yytos; yypParser->yyidx++; if( yypParser->yyidx>=YYSTACKDEPTH ){ ParseARG_FETCH; yypParser->yyidx--; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); } #endif while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ %% ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } yytos = &yypParser->yystack[yypParser->yyidx]; yytos->stateno = yyNewState; yytos->major = yyMajor; yytos->minor = *yypMinor; #ifndef NDEBUG if( yyTraceFILE && yypParser->yyidx>0 ){ int i; fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); for(i=1; i<=yypParser->yyidx; i++) fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); fprintf(yyTraceFILE,"\n"); } #endif } /* The following table contains information about every rule that ** is used during the reduce. */ static struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ } yyRuleInfo[] = { %% }; static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. */ static void yy_reduce( yyParser *yypParser, /* The parser */ int yyruleno /* Number of the rule by which to reduce */ ){ int yygoto; /* The next state */ int yyact; /* The next action */ YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ ParseARG_FETCH; yymsp = &yypParser->yystack[yypParser->yyidx]; #ifndef NDEBUG if( yyTraceFILE && yyruleno>=0 && yyruleno ** { ... } // User supplied code ** #line ** break; */ %% }; yygoto = yyRuleInfo[yyruleno].lhs; yysize = yyRuleInfo[yyruleno].nrhs; yypParser->yyidx -= yysize; yyact = yy_find_reduce_action(yypParser,yygoto); if( yyact < YYNSTATE ){ yy_shift(yypParser,yyact,yygoto,&yygotominor); }else if( yyact == YYNSTATE + YYNRULE + 1 ){ yy_accept(yypParser); } } /* ** The following code executes when the parse fails */ static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ %% ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* ** The following code executes when a syntax error first occurs. */ static void yy_syntax_error( yyParser *yypParser, /* The parser */ int yymajor, /* The major type of the error token */ YYMINORTYPE yyminor /* The minor type of the error token */ ){ ParseARG_FETCH; #define TOKEN (yyminor.yy0) %% ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* ** The following is executed when the parser accepts */ static void yy_accept( yyParser *yypParser /* The parser */ ){ ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ %% ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "ParseAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is ** the minor token. The fourth optional argument is whatever the ** user wants (and specified in the grammar) and is available for ** use by the action routines. ** ** Inputs: **
      **
    • A pointer to the parser (an opaque structure.) **
    • The major token number. **
    • The minor token number. **
    • An option argument of a grammar-specified type. **
    ** ** Outputs: ** None. */ void Parse( void *yyp, /* The parser */ int yymajor, /* The major token code number */ ParseTOKENTYPE yyminor /* The value for the token */ ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; int yyact; /* The parser action. */ int yyendofinput; /* True if we are at the end of input */ int yyerrorhit = 0; /* True if yymajor has invoked an error */ yyParser *yypParser; /* The parser */ /* (re)initialize the parser, if necessary */ yypParser = (yyParser*)yyp; if( yypParser->yyidx<0 ){ if( yymajor==0 ) return; yypParser->yyidx = 0; yypParser->yyerrcnt = -1; yypParser->yystack[0].stateno = 0; yypParser->yystack[0].major = 0; } yyminorunion.yy0 = yyminor; yyendofinput = (yymajor==0); ParseARG_STORE; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); } #endif do{ yyact = yy_find_shift_action(yypParser,yymajor); if( yyactyyerrcnt--; if( yyendofinput && yypParser->yyidx>=0 ){ yymajor = 0; }else{ yymajor = YYNOCODE; } }else if( yyact < YYNSTATE + YYNRULE ){ yy_reduce(yypParser,yyact-YYNSTATE); }else if( yyact == YY_ERROR_ACTION ){ int yymx; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); } #endif #ifdef YYERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". ** ** This is what we do if the grammar does define ERROR: ** ** * Call the %syntax_error function. ** ** * Begin popping the stack until we enter a state where ** it is legal to shift the error symbol, then shift ** the error symbol. ** ** * Set the error count to three. ** ** * Begin accepting and shifting new tokens. No new error ** processing will occur until three tokens have been ** shifted successfully. ** */ if( yypParser->yyerrcnt<0 ){ yy_syntax_error(yypParser,yymajor,yyminorunion); } yymx = yypParser->yystack[yypParser->yyidx].major; if( yymx==YYERRORSYMBOL || yyerrorhit ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sDiscard input token %s\n", yyTracePrompt,yyTokenName[yymajor]); } #endif yy_destructor(yymajor,&yyminorunion); yymajor = YYNOCODE; }else{ while( yypParser->yyidx >= 0 && yymx != YYERRORSYMBOL && (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE ){ yy_pop_parser_stack(yypParser); } if( yypParser->yyidx < 0 || yymajor==0 ){ yy_destructor(yymajor,&yyminorunion); yy_parse_failed(yypParser); yymajor = YYNOCODE; }else if( yymx!=YYERRORSYMBOL ){ YYMINORTYPE u2; u2.YYERRSYMDT = 0; yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); } } yypParser->yyerrcnt = 3; yyerrorhit = 1; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. ** ** * If the input token is $, then fail the parse. ** ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ if( yypParser->yyerrcnt<=0 ){ yy_syntax_error(yypParser,yymajor,yyminorunion); } yypParser->yyerrcnt = 3; yy_destructor(yymajor,&yyminorunion); if( yyendofinput ){ yy_parse_failed(yypParser); } yymajor = YYNOCODE; #endif }else{ yy_accept(yypParser); yymajor = YYNOCODE; } }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); return; } sqlite-2.8.17/tool/spaceanal.tcl0000644000175000001440000003574610232547612016477 0ustar drhusers00000000000000# Run this TCL script using "testfixture" in order get a report that shows # how much disk space is used by a particular data to actually store data # versus how much space is unused. # # Get the name of the database to analyze # if {[llength $argv]!=1} { puts stderr "Usage: $argv0 database-name" exit 1 } set file_to_analyze [lindex $argv 0] if {![file exists $file_to_analyze]} { puts stderr "No such file: $file_to_analyze" exit 1 } if {![file readable $file_to_analyze]} { puts stderr "File is not readable: $file_to_analyze" exit 1 } if {[file size $file_to_analyze]<2048} { puts stderr "Empty or malformed database: $file_to_analyze" exit 1 } # Open the database # sqlite db [lindex $argv 0] set DB [btree_open [lindex $argv 0]] # In-memory database for collecting statistics # sqlite mem :memory: set tabledef\ {CREATE TABLE space_used( name clob, -- Name of a table or index in the database file tblname clob, -- Name of associated table is_index boolean, -- TRUE if it is an index, false for a table nentry int, -- Number of entries in the BTree payload int, -- Total amount of data stored in this table or index mx_payload int, -- Maximum payload size n_ovfl int, -- Number of entries that overflow pri_pages int, -- Number of primary pages used ovfl_pages int, -- Number of overflow pages used pri_unused int, -- Number of unused bytes on primary pages ovfl_unused int -- Number of unused bytes on overflow pages );} mem eval $tabledef # This query will be used to find the root page number for every index and # table in the database. # set sql { SELECT name, tbl_name, type, rootpage FROM sqlite_master WHERE type IN ('table','index') UNION ALL SELECT 'sqlite_master', 'sqlite_master', 'table', 2 ORDER BY 1 } # Analyze every table in the database, one at a time. # foreach {name tblname type rootpage} [db eval $sql] { puts stderr "Analyzing $name..." set cursor [btree_cursor $DB $rootpage 0] set go [btree_first $cursor] set size 0 catch {unset pg_used} set unused_ovfl 0 set n_overflow 0 set cnt_ovfl 0 set n_entry 0 set mx_size 0 set pg_used($rootpage) 1016 while {$go==0} { incr n_entry set payload [btree_payload_size $cursor] incr size $payload set stat [btree_cursor_dump $cursor] set pgno [lindex $stat 0] set freebytes [lindex $stat 4] set pg_used($pgno) $freebytes if {$payload>236} { # if {[lindex $stat 8]==0} {error "overflow is empty with $payload"} set n [expr {($payload-236+1019)/1020}] incr n_overflow $n incr cnt_ovfl incr unused_ovfl [expr {$n*1020+236-$payload}] } else { # if {[lindex $stat 8]!=0} {error "overflow not empty with $payload"} } if {$payload>$mx_size} {set mx_size $payload} set go [btree_next $cursor] } btree_close_cursor $cursor set n_primary [llength [array names pg_used]] set unused_primary 0 foreach x [array names pg_used] {incr unused_primary $pg_used($x)} regsub -all ' $name '' name set sql "INSERT INTO space_used VALUES('$name'" regsub -all ' $tblname '' tblname append sql ",'$tblname',[expr {$type=="index"}],$n_entry" append sql ",$size,$mx_size,$cnt_ovfl," append sql "$n_primary,$n_overflow,$unused_primary,$unused_ovfl);" mem eval $sql } # Generate a single line of output in the statistics section of the # report. # proc statline {title value {extra {}}} { set len [string length $title] set dots [string range {......................................} $len end] set len [string length $value] set sp2 [string range { } $len end] if {$extra ne ""} { set extra " $extra" } puts "$title$dots $value$sp2$extra" } # Generate a formatted percentage value for $num/$denom # proc percent {num denom} { if {$denom==0.0} {return ""} set v [expr {$num*100.0/$denom}] if {$v>1.0 && $v<99.0} { return [format %4.1f%% $v] } elseif {$v<0.1 || $v>99.9} { return [format %6.3f%% $v] } else { return [format %5.2f%% $v] } } # Generate a subreport that covers some subset of the database. # the $where clause determines which subset to analyze. # proc subreport {title where} { set hit 0 mem eval "SELECT sum(nentry) AS nentry, \ sum(payload) AS payload, \ sum(CASE is_index WHEN 1 THEN 0 ELSE payload-4*nentry END) \ AS data, \ max(mx_payload) AS mx_payload, \ sum(n_ovfl) as n_ovfl, \ sum(pri_pages) AS pri_pages, \ sum(ovfl_pages) AS ovfl_pages, \ sum(pri_unused) AS pri_unused, \ sum(ovfl_unused) AS ovfl_unused \ FROM space_used WHERE $where" {} {set hit 1} if {!$hit} {return 0} puts "" set len [string length $title] incr len 5 set stars "***********************************" append stars $stars set stars [string range $stars $len end] puts "*** $title $stars" puts "" statline "Percentage of total database" \ [percent [expr {$pri_pages+$ovfl_pages}] $::file_pgcnt] statline "Number of entries" $nentry set storage [expr {($pri_pages+$ovfl_pages)*1024}] statline "Bytes of storage consumed" $storage statline "Bytes of payload" $payload [percent $payload $storage] statline "Bytes of data" $data [percent $data $storage] set key [expr {$payload-$data}] statline "Bytes of key" $key [percent $key $storage] set avgpay [expr {$nentry>0?$payload/$nentry:0}] statline "Average payload per entry" $avgpay set avgunused [expr {$nentry>0?($pri_unused+$ovfl_unused)/$nentry:0}] statline "Average unused bytes per entry" $avgunused statline "Average fanout" \ [format %.2f [expr {$pri_pages==0?0:($nentry+0.0)/$pri_pages}]] statline "Maximum payload per entry" $mx_payload statline "Entries that use overflow" $n_ovfl [percent $n_ovfl $nentry] statline "Total pages used" [set allpgs [expr {$pri_pages+$ovfl_pages}]] statline "Primary pages used" $pri_pages ;# [percent $pri_pages $allpgs] statline "Overflow pages used" $ovfl_pages ;# [percent $ovfl_pages $allpgs] statline "Unused bytes on primary pages" $pri_unused \ [percent $pri_unused [expr {$pri_pages*1024}]] statline "Unused bytes on overflow pages" $ovfl_unused \ [percent $ovfl_unused [expr {$ovfl_pages*1024}]] set allunused [expr {$ovfl_unused+$pri_unused}] statline "Unused bytes on all pages" $allunused \ [percent $allunused [expr {$allpgs*1024}]] return 1 } # Output summary statistics: # puts "/** Disk-Space Utilization Report For $file_to_analyze" puts "*** As of [clock format [clock seconds] -format {%Y-%b-%d %H:%M:%S}]" puts "" set fsize [file size [lindex $argv 0]] set file_pgcnt [expr {$fsize/1024}] set usedcnt [mem eval {SELECT sum(pri_pages+ovfl_pages) FROM space_used}] set freecnt [expr {$file_pgcnt-$usedcnt-1}] set freecnt2 [lindex [btree_get_meta $DB] 0] statline {Pages in the whole file (measured)} $file_pgcnt set file_pgcnt2 [expr {$usedcnt+$freecnt2+1}] statline {Pages in the whole file (calculated)} $file_pgcnt2 statline {Pages that store data} $usedcnt [percent $usedcnt $file_pgcnt] statline {Pages on the freelist (per header)}\ $freecnt2 [percent $freecnt2 $file_pgcnt] statline {Pages on the freelist (calculated)}\ $freecnt [percent $freecnt $file_pgcnt] statline {Header pages} 1 [percent 1 $file_pgcnt] set ntable [db eval {SELECT count(*)+1 FROM sqlite_master WHERE type='table'}] statline {Number of tables in the database} $ntable set nindex [db eval {SELECT count(*) FROM sqlite_master WHERE type='index'}] set autoindex [db eval {SELECT count(*) FROM sqlite_master WHERE type='index' AND name LIKE '(% autoindex %)'}] set manindex [expr {$nindex-$autoindex}] statline {Number of indices} $nindex statline {Number of named indices} $manindex [percent $manindex $nindex] statline {Automatically generated indices} $autoindex \ [percent $autoindex $nindex] set bytes_data [mem eval "SELECT sum(payload-4*nentry) FROM space_used WHERE NOT is_index AND name!='sqlite_master'"] set total_payload [mem eval "SELECT sum(payload) FROM space_used"] statline "Size of the file in bytes" $fsize statline "Bytes of payload stored" $total_payload \ [percent $total_payload $fsize] statline "Bytes of user data stored" $bytes_data \ [percent $bytes_data $fsize] # Output table rankings # puts "" puts "*** Page counts for all tables with their indices ********************" puts "" mem eval {SELECT tblname, count(*) AS cnt, sum(pri_pages+ovfl_pages) AS size FROM space_used GROUP BY tblname ORDER BY size DESC, tblname} {} { statline [string toupper $tblname] $size [percent $size $file_pgcnt] } # Output subreports # if {$nindex>0} { subreport {All tables and indices} 1 } subreport {All tables} {NOT is_index} if {$nindex>0} { subreport {All indices} {is_index} } foreach tbl [mem eval {SELECT name FROM space_used WHERE NOT is_index ORDER BY name}] { regsub ' $tbl '' qn set name [string toupper $tbl] set n [mem eval "SELECT count(*) FROM space_used WHERE tblname='$qn'"] if {$n>1} { subreport "Table $name and all its indices" "tblname='$qn'" subreport "Table $name w/o any indices" "name='$qn'" subreport "Indices of table $name" "tblname='$qn' AND is_index" } else { subreport "Table $name" "name='$qn'" } } # Output instructions on what the numbers above mean. # puts { *** Definitions ****************************************************** Number of pages in the whole file The number of 1024-byte pages that go into forming the complete database Pages that store data The number of pages that store data, either as primary B*Tree pages or as overflow pages. The number at the right is the data pages divided by the total number of pages in the file. Pages on the freelist The number of pages that are not currently in use but are reserved for future use. The percentage at the right is the number of freelist pages divided by the total number of pages in the file. Header pages The number of pages of header overhead in the database. This value is always 1. The percentage at the right is the number of header pages divided by the total number of pages in the file. Number of tables in the database The number of tables in the database, including the SQLITE_MASTER table used to store schema information. Number of indices The total number of indices in the database. Number of named indices The number of indices created using an explicit CREATE INDEX statement. Automatically generated indices The number of indices used to implement PRIMARY KEY or UNIQUE constraints on tables. Size of the file in bytes The total amount of disk space used by the entire database files. Bytes of payload stored The total number of bytes of payload stored in the database. Payload includes both key and data. The content of the SQLITE_MASTER table is counted when computing this number. The percentage at the right shows the payload divided by the total file size. Bytes of user data stored The total number of bytes of data stored in the database, not counting the database schema information stored in the SQLITE_MASTER table. The percentage at the right is the user data size divided by the total file size. Percentage of total database The amount of the complete database file that is devoted to storing information described by this category. Number of entries The total number of B*Tree key/value pairs stored under this category. Bytes of storage consumed The total amount of disk space required to store all B*Tree entries under this category. The is the total number of pages used times the pages size (1024). Bytes of payload The amount of payload stored under this category. Payload is the sum of keys and data. Each table entry has 4 bytes of key and an arbitrary amount of data. Each index entry has 4 or more bytes of key and no data. The percentage at the right is the bytes of payload divided by the bytes of storage consumed. Bytes of data The amount of data stored under this category. The data space reported includes formatting information such as nul-terminators and field-lengths that are stored with the data. The percentage at the right is the bytes of data divided by bytes of storage consumed. Bytes of key The sum of the sizes of all keys under this category. The percentage at the right is the bytes of key divided by the bytes of storage consumed. Average payload per entry The average amount of payload on each entry. This is just the bytes of payload divided by the number of entries. Average unused bytes per entry The average amount of free space remaining on all pages under this category on a per-entry basis. This is the number of unused bytes on all pages divided by the number of entries. Maximum payload per entry The largest payload size of any entry. Entries that use overflow Up to 236 bytes of payload for each entry are stored directly in the primary B*Tree page. Any additional payload is stored on a linked list of overflow pages. This is the number of entries that exceed 236 bytes in size. The value to the right is the number of entries that overflow divided by the total number of entries. Total pages used This is the number of 1024 byte pages used to hold all information in the current category. This is the sum of primary and overflow pages. Primary pages used This is the number of primary B*Tree pages used. Overflow pages used The total number of overflow pages used for this category. Unused bytes on primary pages The total number of bytes of unused space on all primary pages. The percentage at the right is the number of unused bytes divided by the total number of bytes on primary pages. Unused bytes on overflow pages The total number of bytes of unused space on all overflow pages. The percentage at the right is the number of unused bytes divided by the total number of bytes on overflow pages. Unused bytes on all pages The total number of bytes of unused space on all primary and overflow pages. The percentage at the right is the number of unused bytes divided by the total number of bytes. } # Output the database # puts "**********************************************************************" puts "The entire text of this report can be sourced into any SQL database" puts "engine for further analysis. All of the text above is an SQL comment." puts "The data used to generate this report follows:" puts "*/" puts "BEGIN;" puts $tabledef unset -nocomplain x mem eval {SELECT * FROM space_used} x { puts -nonewline "INSERT INTO space_used VALUES(" regsub ' $x(name) '' qn regsub ' $x(tblname) '' qtn puts -nonewline "'$qn','$qtn'," puts -nonewline "$x(is_index),$x(nentry),$x(payload),$x(mx_payload)," puts -nonewline "$x(n_ovfl),$x(pri_pages),$x(ovfl_pages),$x(pri_unused)," puts "$x(ovfl_unused));" } puts "COMMIT;" sqlite-2.8.17/tool/speedtest.tcl0000644000175000001440000001536510232547612016543 0ustar drhusers00000000000000#!/usr/bin/tclsh # # Run this script using TCLSH to do a speed comparison between # various versions of SQLite and PostgreSQL and MySQL # # Run a test # set cnt 1 proc runtest {title} { global cnt set sqlfile test$cnt.sql puts "

    Test $cnt: $title

    " incr cnt set fd [open $sqlfile r] set sql [string trim [read $fd [file size $sqlfile]]] close $fd set sx [split $sql \n] set n [llength $sx] if {$n>8} { set sql {} for {set i 0} {$i<3} {incr i} {append sql [lindex $sx $i]
    \n} append sql "... [expr {$n-6}] lines omitted
    \n" for {set i [expr {$n-3}]} {$i<$n} {incr i} { append sql [lindex $sx $i]
    \n } } else { regsub -all \n [string trim $sql]
    sql } puts "
    " puts "$sql" puts "
    " set format {} set delay 1000 # exec sync; after $delay; # set t [time "exec psql drh <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format PostgreSQL: $t] exec sync; after $delay; set t [time "exec mysql -f drh <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format MySQL: $t] # set t [time "exec ./sqlite232 s232.db <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format {SQLite 2.3.2:} $t] # set t [time "exec ./sqlite-100 s100.db <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format {SQLite 2.4 (cache=100):} $t] exec sync; after $delay; set t [time "exec ./sqlite248 s2k.db <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format {SQLite 2.4.8:} $t] exec sync; after $delay; set t [time "exec ./sqlite248 sns.db <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format {SQLite 2.4.8 (nosync):} $t] exec sync; after $delay; set t [time "exec ./sqlite2412 s2kb.db <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format {SQLite 2.4.12:} $t] exec sync; after $delay; set t [time "exec ./sqlite2412 snsb.db <$sqlfile" 1] set t [expr {[lindex $t 0]/1000000.0}] puts [format $format {SQLite 2.4.12 (nosync):} $t] # set t [time "exec ./sqlite-t1 st1.db <$sqlfile" 1] # set t [expr {[lindex $t 0]/1000000.0}] # puts [format $format {SQLite 2.4 (test):} $t] puts "
    %s   %.3f
    " } # Initialize the environment # expr srand(1) catch {exec /bin/sh -c {rm -f s*.db}} set fd [open clear.sql w] puts $fd { drop table t1; drop table t2; } close $fd catch {exec psql drh =1000} { set txt "[number_name [expr {$n/1000}]] thousand" set n [expr {$n%1000}] } else { set txt {} } if {$n>=100} { append txt " [lindex $::ones [expr {$n/100}]] hundred" set n [expr {$n%100}] } if {$n>=20} { append txt " [lindex $::tens [expr {$n/10}]]" set n [expr {$n%10}] } if {$n>0} { append txt " [lindex $::ones $n]" } set txt [string trim $txt] if {$txt==""} {set txt zero} return $txt } set fd [open test$cnt.sql w] puts $fd "CREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));" for {set i 1} {$i<=1000} {incr i} { set r [expr {int(rand()*100000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } close $fd runtest {1000 INSERTs} set fd [open test$cnt.sql w] puts $fd "BEGIN;" puts $fd "CREATE TABLE t2(a INTEGER, b INTEGER, c VARCHAR(100));" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "INSERT INTO t2 VALUES($i,$r,'[number_name $r]');" } puts $fd "COMMIT;" close $fd runtest {25000 INSERTs in a transaction} set fd [open test$cnt.sql w] for {set i 0} {$i<100} {incr i} { set lwr [expr {$i*100}] set upr [expr {($i+10)*100}] puts $fd "SELECT count(*), avg(b) FROM t2 WHERE b>=$lwr AND b<$upr;" } close $fd runtest {100 SELECTs without an index} set fd [open test$cnt.sql w] for {set i 1} {$i<=100} {incr i} { puts $fd "SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%[number_name $i]%';" } close $fd runtest {100 SELECTs on a string comparison} set fd [open test$cnt.sql w] puts $fd {CREATE INDEX i2a ON t2(a);} puts $fd {CREATE INDEX i2b ON t2(b);} close $fd runtest {Creating an index} set fd [open test$cnt.sql w] for {set i 0} {$i<5000} {incr i} { set lwr [expr {$i*100}] set upr [expr {($i+1)*100}] puts $fd "SELECT count(*), avg(b) FROM t2 WHERE b>=$lwr AND b<$upr;" } close $fd runtest {5000 SELECTs with an index} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 0} {$i<1000} {incr i} { set lwr [expr {$i*10}] set upr [expr {($i+1)*10}] puts $fd "UPDATE t1 SET b=b*2 WHERE a>=$lwr AND a<$upr;" } puts $fd "COMMIT;" close $fd runtest {1000 UPDATEs without an index} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "UPDATE t2 SET b=$r WHERE a=$i;" } puts $fd "COMMIT;" close $fd runtest {25000 UPDATEs with an index} set fd [open test$cnt.sql w] puts $fd "BEGIN;" for {set i 1} {$i<=25000} {incr i} { set r [expr {int(rand()*500000)}] puts $fd "UPDATE t2 SET c='[number_name $r]' WHERE a=$i;" } puts $fd "COMMIT;" close $fd runtest {25000 text UPDATEs with an index} set fd [open test$cnt.sql w] puts $fd "BEGIN;" puts $fd "INSERT INTO t1 SELECT * FROM t2;" puts $fd "INSERT INTO t2 SELECT * FROM t1;" puts $fd "COMMIT;" close $fd runtest {INSERTs from a SELECT} set fd [open test$cnt.sql w] puts $fd {DELETE FROM t2 WHERE c LIKE '%fifty%';} close $fd runtest {DELETE without an index} set fd [open test$cnt.sql w] puts $fd {DELETE FROM t2 WHERE a>10 AND a<20000;} close $fd runtest {DELETE with an index} set fd [open test$cnt.sql w] puts $fd {INSERT INTO t2 SELECT * FROM t1;} close $fd runtest {A big INSERT after a big DELETE} set fd [open test$cnt.sql w] puts $fd {BEGIN;} puts $fd {DELETE FROM t1;} for {set i 1} {$i<=3000} {incr i} { set r [expr {int(rand()*100000)}] puts $fd "INSERT INTO t1 VALUES($i,$r,'[number_name $r]');" } puts $fd {COMMIT;} close $fd runtest {A big DELETE followed by many small INSERTs} set fd [open test$cnt.sql w] puts $fd {DROP TABLE t1;} puts $fd {DROP TABLE t2;} close $fd runtest {DROP TABLE} sqlite-2.8.17/tool/space_used.tcl0000644000175000001440000000645210232547612016653 0ustar drhusers00000000000000# Run this TCL script using "testfixture" in order get a report that shows # how much disk space is used by a particular data to actually store data # versus how much space is unused. # # Get the name of the database to analyze # if {[llength $argv]!=1} { puts stderr "Usage: $argv0 database-name" exit 1 } set file_to_analyze [lindex $argv 0] # Open the database # sqlite db [lindex $argv 0] set DB [btree_open [lindex $argv 0]] # Output the schema for the generated report # puts \ {BEGIN; CREATE TABLE space_used( name clob, -- Name of a table or index in the database file is_index boolean, -- TRUE if it is an index, false for a table payload int, -- Total amount of data stored in this table or index pri_pages int, -- Number of primary pages used ovfl_pages int, -- Number of overflow pages used pri_unused int, -- Number of unused bytes on primary pages ovfl_unused int -- Number of unused bytes on overflow pages );} # This query will be used to find the root page number for every index and # table in the database. # set sql { SELECT name, type, rootpage FROM sqlite_master UNION ALL SELECT 'sqlite_master', 'table', 2 ORDER BY 1 } # Initialize variables used for summary statistics. # set total_size 0 set total_primary 0 set total_overflow 0 set total_unused_primary 0 set total_unused_ovfl 0 # Analyze every table in the database, one at a time. # foreach {name type rootpage} [db eval $sql] { set cursor [btree_cursor $DB $rootpage 0] set go [btree_first $cursor] set size 0 catch {unset pg_used} set unused_ovfl 0 set n_overflow 0 while {$go==0} { set payload [btree_payload_size $cursor] incr size $payload set stat [btree_cursor_dump $cursor] set pgno [lindex $stat 0] set freebytes [lindex $stat 4] set pg_used($pgno) $freebytes if {$payload>238} { set n [expr {($payload-238+1019)/1020}] incr n_overflow $n incr unused_ovfl [expr {$n*1020+238-$payload}] } set go [btree_next $cursor] } btree_close_cursor $cursor set n_primary [llength [array names pg_used]] set unused_primary 0 foreach x [array names pg_used] {incr unused_primary $pg_used($x)} regsub -all ' $name '' name puts -nonewline "INSERT INTO space_used VALUES('$name'" puts -nonewline ",[expr {$type=="index"}]" puts ",$size,$n_primary,$n_overflow,$unused_primary,$unused_ovfl);" incr total_size $size incr total_primary $n_primary incr total_overflow $n_overflow incr total_unused_primary $unused_primary incr total_unused_ovfl $unused_ovfl } # Output summary statistics: # puts "-- Total payload size: $total_size" puts "-- Total pages used: $total_primary primary and $total_overflow overflow" set file_pgcnt [expr {[file size [lindex $argv 0]]/1024}] puts -nonewline "-- Total unused bytes on primary pages: $total_unused_primary" if {$total_primary>0} { set upp [expr {$total_unused_primary/$total_primary}] puts " (avg $upp bytes/page)" } else { puts "" } puts -nonewline "-- Total unused bytes on overflow pages: $total_unused_ovfl" if {$total_overflow>0} { set upp [expr {$total_unused_ovfl/$total_overflow}] puts " (avg $upp bytes/page)" } else { puts "" } set n_free [expr {$file_pgcnt-$total_primary-$total_overflow}] if {$n_free>0} {incr n_free -1} puts "-- Total pages on freelist: $n_free" puts "COMMIT;" sqlite-2.8.17/tool/memleak2.awk0000644000175000001440000000173710232547612016236 0ustar drhusers00000000000000# This AWK script reads the output of testfixture when compiled for memory # debugging. It generates SQL commands that can be fed into an sqlite # instance to determine what memory is never freed. A typical usage would # be as follows: # # make -f memleak.mk fulltest 2>mem.out # awk -f ../sqlite/tool/memleak2.awk mem.out | ./sqlite :memory: # # The job performed by this script is the same as that done by memleak.awk. # The difference is that this script uses much less memory when the size # of the mem.out file is huge. # BEGIN { print "CREATE TABLE mem(loc INTEGER PRIMARY KEY, src);" } /[0-9]+ malloc / { print "INSERT INTO mem VALUES(" strtonum($6) ",'" $0 "');" } /[0-9]+ realloc / { print "INSERT INTO mem VALUES(" strtonum($10) \ ",(SELECT src FROM mem WHERE loc=" strtonum($8) "));" print "DELETE FROM mem WHERE loc=" strtonum($8) ";" } /[0-9]+ free / { print "DELETE FROM mem WHERE loc=" strtonum($6) ";" } END { print "SELECT src FROM mem;" } sqlite-2.8.17/tool/mkopts.tcl0000755000175000001440000000221010232547612016044 0ustar drhusers00000000000000#!/usr/bin/tclsh # # This script is used to generate the array of strings and the enum # that appear at the beginning of the C code implementation of a # a TCL command and that define the available subcommands for that # TCL command. set prefix {} while {![eof stdin]} { set line [gets stdin] if {$line==""} continue regsub -all "\[ \t\n,\]+" [string trim $line] { } line foreach token [split $line { }] { if {![regexp {(([a-zA-Z]+)_)?([_a-zA-Z]+)} $token all px p2 name]} continue lappend namelist [string tolower $name] if {$px!=""} {set prefix $p2} } } puts " static const char *${prefix}_strs\[\] = \173" set col 0 proc put_item x { global col if {$col==0} {puts -nonewline " "} if {$col<2} { puts -nonewline [format " %-21s" $x] incr col } else { puts $x set col 0 } } proc finalize {} { global col if {$col>0} {puts {}} set col 0 } foreach name [lsort $namelist] { put_item \"$name\", } put_item 0 finalize puts " \175;" puts " enum ${prefix}_enum \173" foreach name [lsort $namelist] { regsub -all {@} $name {} name put_item ${prefix}_[string toupper $name], } finalize puts " \175;" sqlite-2.8.17/tool/memleak.awk0000644000175000001440000000100110232547612016134 0ustar drhusers00000000000000# # This script looks for memory leaks by analyzing the output of "sqlite" # when compiled with the MEMORY_DEBUG=2 option. # /[0-9]+ malloc / { mem[$6] = $0 } /[0-9]+ realloc / { mem[$8] = ""; mem[$10] = $0 } /[0-9]+ free / { if (mem[$6]=="") { print "*** free without a malloc at",$6 } mem[$6] = ""; str[$6] = "" } /^string at / { addr = $4 sub("string at " addr " is ","") str[addr] = $0 } END { for(addr in mem){ if( mem[addr]=="" ) continue print mem[addr], str[addr] } } sqlite-2.8.17/tool/opcodeDoc.awk0000644000175000001440000000077310232547612016437 0ustar drhusers00000000000000# # Extract opcode documentation for sqliteVdbe.c and generate HTML # BEGIN { print "" print "

    SQLite Virtual Database Engine Opcodes

    " print "" } / Opcode: /,/\*\// { if( $2=="Opcode:" ){ printf "\n\n" }else if( NF>1 ){ sub(/^ *\*\* /,"") gsub(/" } sqlite-2.8.17/tool/showjournal.c0000644000175000001440000000335710232547612016554 0ustar drhusers00000000000000/* ** A utility for printing an SQLite database journal. */ #include #include #include #include #include #include #include static int pagesize = 1024; static int db = -1; static int mxPage = 0; static void out_of_memory(void){ fprintf(stderr,"Out of memory...\n"); exit(1); } static print_page(int iPg){ unsigned char *aData; int i, j; aData = malloc(pagesize); if( aData==0 ) out_of_memory(); read(db, aData, pagesize); fprintf(stdout, "Page %d:\n", iPg); for(i=0; i@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= AC_LIBTOOL_LANG_C_CONFIG _LT_AC_TAGCONFIG ])# AC_LIBTOOL_SETUP # _LT_AC_SYS_COMPILER # ------------------- AC_DEFUN([_LT_AC_SYS_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_AC_SYS_COMPILER # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], [AC_LINK_IFELSE(AC_LANG_PROGRAM,[ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_AC_SYS_LIBPATH_AIX # _LT_AC_SHELL_INIT(ARG) # ---------------------- AC_DEFUN([_LT_AC_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_AC_SHELL_INIT # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac echo=${ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(ECHO) ])])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_LOCK # ----------- AC_DEFUN([_LT_AC_LOCK], [AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac need_locks="$enable_libtool_lock" ])# _LT_AC_LOCK # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED]) AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then $2=yes fi fi $rm conftest* ]) if test x"[$]$2" = xyes; then ifelse([$5], , :, [$5]) else ifelse([$6], , :, [$6]) fi ])# AC_LIBTOOL_COMPILER_OPTION # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD else $2=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then ifelse([$4], , :, [$4]) else ifelse([$5], , :, [$5]) fi ])# AC_LIBTOOL_LINKER_OPTION # AC_LIBTOOL_SYS_MAX_CMD_LEN # -------------------------- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [# find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 testring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ = "XX$testring") >/dev/null 2>&1 && new_result=`expr "X$testring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` testring=$testring$testring done testring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi ])# AC_LIBTOOL_SYS_MAX_CMD_LEN # _LT_AC_CHECK_DLFCN # -------------------- AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_unknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_AC_TRY_DLOPEN_SELF # AC_LIBTOOL_DLOPEN_SELF # ------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then LDFLAGS="$LDFLAGS $link_static_flag" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi ])# AC_LIBTOOL_DLOPEN_SELF # AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* ]) ])# AC_LIBTOOL_PROG_CC_C_O # AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) # ----------------------------------------- # Check to see if we can do hard links to lock some files if needed AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_REQUIRE([_LT_AC_LOCK])dnl hard_links="nottested" if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi ])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS # AC_LIBTOOL_OBJDIR # ----------------- AC_DEFUN([AC_LIBTOOL_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir ])# AC_LIBTOOL_OBJDIR # AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) # ---------------------------------------------- # Check hardcoding attributes. AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi ])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH # AC_LIBTOOL_SYS_LIB_STRIP # ------------------------ AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], [striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi ])# AC_LIBTOOL_SYS_LIB_STRIP # AC_LIBTOOL_SYS_DYNAMIC_LINKER # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case "$host_cpu" in ia64*) shrext='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], [AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then AC_MSG_WARN([output file `$ofile' does not exist]) fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) else AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) fi fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in "") ;; *) AC_MSG_ERROR([invalid tag name: $tagname]) ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then AC_MSG_ERROR([tag name \"$tagname\" already exists]) fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && test "X$CXX" != "Xno"; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then AC_LIBTOOL_LANG_F77_CONFIG else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then AC_LIBTOOL_LANG_GCJ_CONFIG else tagname="" fi ;; RC) AC_LIBTOOL_LANG_RC_CONFIG ;; *) AC_MSG_ERROR([Unsupported tag name: $tagname]) ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" AC_MSG_ERROR([unable to update list of available tagged configurations.]) fi fi ])# _LT_AC_TAGCONFIG # AC_LIBTOOL_DLOPEN # ----------------- # enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_DLOPEN # AC_LIBTOOL_WIN32_DLL # -------------------- # declare package support for building win32 dll's AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL # AC_ENABLE_SHARED([DEFAULT]) # --------------------------- # implement the --enable-shared flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]AC_ENABLE_SHARED_DEFAULT) ])# AC_ENABLE_SHARED # AC_DISABLE_SHARED # ----------------- #- set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no) ])# AC_DISABLE_SHARED # AC_ENABLE_STATIC([DEFAULT]) # --------------------------- # implement the --enable-static flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]AC_ENABLE_STATIC_DEFAULT) ])# AC_ENABLE_STATIC # AC_DISABLE_STATIC # ----------------- # set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no) ])# AC_DISABLE_STATIC # AC_ENABLE_FAST_INSTALL([DEFAULT]) # --------------------------------- # implement the --enable-fast-install flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) ])# AC_ENABLE_FAST_INSTALL # AC_DISABLE_FAST_INSTALL # ----------------------- # set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no) ])# AC_DISABLE_FAST_INSTALL # AC_LIBTOOL_PICMODE([MODE]) # -------------------------- # implement the --with-pic flag # MODE is either `yes' or `no'. If omitted, it defaults to `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default) ])# AC_LIBTOOL_PICMODE # AC_PROG_EGREP # ------------- # This is predefined starting with Autoconf 2.54, so this conditional # definition can be removed once we require Autoconf 2.54 or later. m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi]) EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ])]) # AC_PATH_TOOL_PREFIX # ------------------- # find a file program which can recognise shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ])# AC_PATH_TOOL_PREFIX # AC_PATH_MAGIC # ------------- # find a file program which can recognise a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# AC_PATH_MAGIC # AC_PROG_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([LT_AC_PROG_SED])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case "$host_cpu" in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' else lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown ])# AC_DEPLIBS_CHECK_METHOD # AC_PROG_NM # ---------- # find the pathname to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/${ac_tool_prefix}nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac esac fi done IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" ])# AC_PROG_NM # AC_CHECK_LIBM # ------------- # check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac ])# AC_CHECK_LIBM # AC_LIBLTDL_CONVENIENCE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL # and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If # DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_CONVENIENCE # AC_LIBLTDL_INSTALLABLE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that LIBLTDL # and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If # DIRECTORY is not provided and an installed libltdl is not found, it is # assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' # and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single # quotes!). If your package is not flat and you're not using automake, # define top_builddir and top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, lt_dlinit, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLINCL= fi # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_INSTALLABLE # AC_LIBTOOL_CXX # -------------- # enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_LT_AC_LANG_CXX]) ])# AC_LIBTOOL_CXX # _LT_AC_LANG_CXX # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX # AC_LIBTOOL_F77 # -------------- # enable support for Fortran 77 libraries AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_LT_AC_LANG_F77]) ])# AC_LIBTOOL_F77 # _LT_AC_LANG_F77 # --------------- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ])# _LT_AC_LANG_F77 # AC_LIBTOOL_GCJ # -------------- # enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ], [AC_REQUIRE([_LT_AC_LANG_GCJ]) ])# AC_LIBTOOL_GCJ # _LT_AC_LANG_GCJ # --------------- AC_DEFUN([_LT_AC_LANG_GCJ], [AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ])# _LT_AC_LANG_GCJ # AC_LIBTOOL_RC # -------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ])# AC_LIBTOOL_RC # AC_LIBTOOL_LANG_C_CONFIG # ------------------------ # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) AC_DEFUN([_LT_AC_LANG_C_CONFIG], [lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER # # Check for any special shared library compilation flags. # _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= if test "$GCC" = no; then case $host_os in sco3.2v5*) _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' ;; esac fi if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : else AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no fi fi # # Check to make sure the static flag actually works. # AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF($1) # Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; darwin* | rhapsody*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ;; esac fi ;; esac output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_C_CONFIG # AC_LIBTOOL_LANG_CXX_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Dependencies to place before and after the object being linked: _LT_AC_TAGVAR(predep_objects, $1)= _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= # Source file extension for C++ test sources. ac_ext=cc # Object file extension for compiled C++ test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration AC_PROG_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_AC_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=yes else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds it's shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; dgux*) case $cc_basename in ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | kfreebsd*-gnu) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then case "$host_cpu" in hppa*64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; *) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case "$host_cpu" in hppa*64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case "$host_cpu" in ia64*|hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; irix5* | irix6*) case $cc_basename in CC) # SGI C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; linux*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc) # Intel C++ with_gnu_ld=yes _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; osf3*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' fi ;; esac ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_AC_TAGVAR(GCC, $1)="$GXX" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_POSTDEP_PREDEP($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ])# AC_LIBTOOL_LANG_CXX_CONFIG # AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) # ------------------------ # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" ifelse([$1], [], [#! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG], [# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext='$shrext' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) ifelse([$1],[], [# ### END LIBTOOL CONFIG], [# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ ifelse([$1],[], [ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ]) else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ])# AC_LIBTOOL_CONFIG # AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi ])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32*) symcode='[[ABCDGISTW]]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris* | sysv5*) symcode='[[BDRT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[[]] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) # --------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], [_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) ifelse([$1],[CXX],[ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; icpc) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | knetbsd*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; sco*) case $cc_basename in CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; unixware*) ;; vxworks*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; newsos6) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; linux*) case $CC in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; sco3.2v5*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' ;; solaris*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sunos4*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi case "$host_os" in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac ]) # AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)= _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_AC_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac _LT_AC_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else ld_shlibs=no fi ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; sunos4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; linux*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac if test $supports_anon_versioning = yes; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" fi else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=yes _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=yes else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds it's shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # see comment about different semantics on the GNU ld section _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; bsdi4*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext=".dll" # FIXME: Setting linknames here is a bad hack. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) if test "$GXX" = yes ; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; dgux*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac fi if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; *) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; openbsd*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi ;; os2*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; sco3.2v5*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_AC_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_AC_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4.2uw2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' fi runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv5*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' ;; uts4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # # Do we need to explicitly link libc? # case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_AC_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) _LT_AC_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac ])# AC_LIBTOOL_PROG_LD_SHLIBS # _LT_AC_FILE_LTDLL_C # ------------------- # Be careful that the start marker always follows a newline. AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ ])# _LT_AC_FILE_LTDLL_C # _LT_AC_TAGVAR(VARNAME, [TAGNAME]) # --------------------------------- AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # # LT_AC_PROG_SED # -------------- # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. AC_DEFUN([LT_AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && break cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done SED=$lt_cv_path_SED ]) AC_MSG_RESULT([$SED]) ]) sqlite-2.8.17/README0000644000175000001440000000311410232547613013730 0ustar drhusers00000000000000This directory contains source code to SQLite: An Embeddable SQL Database Engine To compile the project, first create a directory in which to place the build products. It is recommended, but not required, that the build directory be separate from the source directory. Cd into the build directory and then from the build directory run the configure script found at the root of the source tree. Then run "make". For example: tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite" mkdir bld ;# Build will occur in a sibling directory cd bld ;# Change to the build directory ../sqlite/configure ;# Run the configure script make ;# Run the makefile. The configure script uses autoconf 2.50 and libtool. If the configure script does not work out for you, there is a generic makefile named "Makefile.linux-gcc" in the top directory of the source tree that you can copy and edit to suite your needs. Comments on the generic makefile show what changes are needed. The linux binaries on the website are created using the generic makefile, not the configure script. The configure script is unmaintained. (You can volunteer to take over maintenance of the configure script, if you want!) The windows binaries on the website are created using MinGW32 configured as a cross-compiler running under Linux. For details, see the ./publish.sh script at the top-level of the source tree. Contacts: http://www.sqlite.org/ http://www.hwaci.com/sw/sqlite/ http://groups.yahoo.com/group/sqlite/ drh@hwaci.com sqlite-2.8.17/ltmain.sh0000644000175000001440000054474010232547613014707 0ustar drhusers00000000000000# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # End of Shell function definitions ##################################### # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit 1 ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2003 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit 0 ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" done exit 0 ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit 1 ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. if test -n "$available_tags" && test -z "$tagname"; then case $base_compile in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" case "$base_compile " in "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit 1 # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T < /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" case $base_compile in "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) # The compiler in $compile_command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit 1 # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi # We need to know -static, to get the right output filenames. for arg do case $arg in -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit 1 fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit 1 else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit 1 fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit 1 fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit 1 else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplcations in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit 1 ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against it, someone # is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$deplibs $depdepl" ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi # We will extract separately just the conflicting names and we will no # longer touch any unique names. It is faster to leave these extract # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$save_output-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$save_output-${k}.$objext k=`expr $k + 1` output=$output_objdir/$save_output-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit 0 fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi # We will extract separately just the conflicting names and we will no # longer touch any unique names. It is faster to leave these extract # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit 0 fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case $0 in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR #define DIR_SEPARATOR '/' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) #define HAVE_DOS_BASED_FILE_SYSTEM #ifndef DIR_SEPARATOR_2 #define DIR_SEPARATOR_2 '\\' #endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * fnqualify(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = fnqualify(argv[0]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } char * fnqualify(const char *path) { size_t size; char *p; char tmp[LT_PATHMAX + 1]; assert(path != NULL); /* Is it qualified already? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (path[0]) && path[1] == ':') return xstrdup (path); #endif if (IS_DIR_SEPARATOR (path[0])) return xstrdup (path); /* prepend the current directory */ /* doesn't handle '~' */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ p = XMALLOC(char, size); sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); return p; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi # We will extract separately just the conflicting names and we will no # longer touch any unique names. It is faster to leave these extract # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit 1 fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit 1 fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit 1 fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs' else exit 0 fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit 0 $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit 1 fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit 0 ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: sqlite-2.8.17/configure0000755000175000001440000247151710232547613015001 0ustar drhusers00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="src/sqlite.h.in" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CPP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA program_prefix VERSION BUILD_CC BUILD_CFLAGS BUILD_LIBS TARGET_CC TARGET_CFLAGS TARGET_LINK TARGET_LFLAGS TARGET_RANLIB TARGET_AR ENCODING ALLOWATTACHMEM ALLOWRELEASE INMEMORYDB TEMP_STORE BUILD_EXEEXT OS_UNIX OS_WIN TARGET_EXEEXT TARGET_LIBS TARGET_TCL_LIBS TARGET_TCL_INC TARGET_READLINE_LIBS TARGET_READLINE_INC TARGET_HAVE_READLINE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-utf8 Use UTF-8 encodings --enable-incore-db Support incore database --enable-releasemode Support libtool link to release mode --enable-tempdb-in-ram Use an in-ram database for temporary tables Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-hints=FILE Read configuration options from FILE Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # The following RCS revision string applies to configure.in # $Revision: 1.21 $ ######### # Programs needed # # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && break cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done SED=$lt_cv_path_SED fi echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/${ac_tool_prefix}nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac esac fi done IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi4*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case "$host_cpu" in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' else lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 3050 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case "`/usr/bin/file conftest.o`" in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:4505:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 testring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ = "XX$testring") >/dev/null 2>&1 && new_result=`expr "X$testring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` testring=$testring$testring done testring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris* | sysv5*) symcode='[BDRT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" ;; *) old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC # # Check for any special shared library compilation flags. # lt_prog_cc_shlib= if test "$GCC" = no; then case $host_os in sco3.2v5*) lt_prog_cc_shlib='-belf' ;; esac fi if test -n "$lt_prog_cc_shlib"; then { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : else { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} lt_cv_prog_cc_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_prog_compiler_static" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:5537: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:5541: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $CC in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; sco3.2v5*) lt_prog_compiler_pic='-Kpic' lt_prog_compiler_static='-dn' ;; solaris*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:5770: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:5774: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case "$host_os" in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:5830: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:5834: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else ld_shlibs=no fi ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; linux*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_cmds="$tmp_archive_cmds" supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else archive_expsym_cmds="$tmp_archive_cmds" fi else ld_shlibs=no fi ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.012|aix4.012.*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec=' ' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi4*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) if test "$GXX" = yes ; then archive_cmds_need_lc=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='-flat_namespace -undefined suppress' ;; 10.*) allow_undefined_flag='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='-all_load $convenience' link_all_deplibs=yes else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*|ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case "$host_cpu" in hppa*64*|ia64*) archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac fi if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=no hardcode_shlibpath_var=no ;; ia64*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=no hardcode_shlibpath_var=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; *) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4.2uw2*) archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=no hardcode_shlibpath_var=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) no_undefined_flag='${wl}-z ${wl}text' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' fi runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv5*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec= hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.01* | freebsdelf3.01*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case "$host_cpu" in ia64*) shrext='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var " || \ test "X$hardcode_automatic"="Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_unknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then LDFLAGS="$LDFLAGS $link_static_flag" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which librarie types wil actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; darwin* | rhapsody*) if test "$GCC" = yes; then archive_cmds_need_lc=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='-flat_namespace -undefined suppress' ;; 10.*) allow_undefined_flag='-undefined dynamic_lookup' ;; esac fi ;; esac output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='-all_load $convenience' link_all_deplibs=yes else ld_shlibs=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext='$shrext' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && test "X$CXX" != "Xno"; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cc # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.012|aix4.012.*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols_CXX=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX=' ' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) if test "$GXX" = yes; then archive_cmds_need_lc_CXX=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='-flat_namespace -undefined suppress' ;; 10.*) allow_undefined_flag_CXX='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='-all_load $convenience' link_all_deplibs_CXX=yes else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd12*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld_CXX='+b $libdir' hardcode_libdir_separator_CXX=: ;; ia64*) hardcode_libdir_flag_spec_CXX='-L$libdir' ;; *) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case "$host_cpu" in hppa*64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case "$host_cpu" in ia64*|hppa*64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; irix5* | irix6*) case $cc_basename in CC) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc) # Intel C++ with_gnu_ld=yes archive_cmds_need_lc_CXX=no archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; osf3*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sco*) archive_cmds_need_lc_CXX=no case $cc_basename in CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.0-5 | solaris2.0-5.*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) archive_cmds_need_lc_CXX=no ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | knetbsd*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; sco*) case $cc_basename in CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; unixware*) ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10280: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:10284: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case "$host_os" in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10340: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:10344: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.01* | freebsdelf3.01*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case "$host_cpu" in ia64*) shrext='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var CXX" || \ test "X$hardcode_automatic_CXX"="Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_unknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then LDFLAGS="$LDFLAGS $link_static_flag" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext='$shrext' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $CC in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; sco3.2v5*) lt_prog_compiler_pic_F77='-Kpic' lt_prog_compiler_static_F77='-dn' ;; solaris*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:12619: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:12623: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case "$host_os" in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:12679: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:12683: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else ld_shlibs=no fi ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; linux*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_cmds_F77="$tmp_archive_cmds" supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else archive_expsym_cmds_F77="$tmp_archive_cmds" fi else ld_shlibs_F77=no fi ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.012|aix4.012.*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols_F77=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77=' ' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi4*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) if test "$GXX" = yes ; then archive_cmds_need_lc_F77=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='-flat_namespace -undefined suppress' ;; 10.*) allow_undefined_flag_F77='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='-all_load $convenience' link_all_deplibs_F77=yes else ld_shlibs_F77=no fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*|ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case "$host_cpu" in hppa*64*|ia64*) archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; *) archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac fi if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; ia64*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; *) hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; sco3.2v5*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4.2uw2*) archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) no_undefined_flag_F77='${wl}-z ${wl}text' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' fi runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv5*) no_undefined_flag_F77=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec_F77= hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.01* | freebsdelf3.01*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case "$host_cpu" in ia64*) shrext='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var F77" || \ test "X$hardcode_automatic_F77"="Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext='$shrext' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14711: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14715: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $CC in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; sco3.2v5*) lt_prog_compiler_pic_GCJ='-Kpic' lt_prog_compiler_static_GCJ='-dn' ;; solaris*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14944: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14948: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case "$host_os" in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15004: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:15008: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else ld_shlibs=no fi ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; linux*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_cmds_GCJ="$tmp_archive_cmds" supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else archive_expsym_cmds_GCJ="$tmp_archive_cmds" fi else ld_shlibs_GCJ=no fi ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.012|aix4.012.*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols_GCJ=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ=' ' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi4*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) if test "$GXX" = yes ; then archive_cmds_need_lc_GCJ=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' ;; 10.*) allow_undefined_flag_GCJ='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='-all_load $convenience' link_all_deplibs_GCJ=yes else ld_shlibs_GCJ=no fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*|ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case "$host_cpu" in hppa*64*|ia64*) archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; *) archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac fi if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; ia64*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; *) hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; sco3.2v5*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4.2uw2*) archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) no_undefined_flag_GCJ='${wl}-z ${wl}text' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' fi runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv5*) no_undefined_flag_GCJ=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec_GCJ= hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.01* | freebsdelf3.01*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case "$host_cpu" in ia64*) shrext='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var GCJ" || \ test "X$hardcode_automatic_GCJ"="Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_unknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then LDFLAGS="$LDFLAGS $link_static_flag" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext='$shrext' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext='$shrext' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ######### # Set up an appropriate program prefix # if test "$program_prefix" = "NONE"; then program_prefix="" fi if test -f VERSION; then VERSION=`cat VERSION` echo "Version set to $VERSION" fi ######### # Check to see if the --with-hints=FILE option is used. If there is none, # then check for a files named "$host.hints" and ../$hosts.hints where # $host is the hostname of the build system. If still no hints are # found, try looking in $system.hints and ../$system.hints where # $system is the result of uname -s. # # Check whether --with-hints or --without-hints was given. if test "${with_hints+set}" = set; then withval="$with_hints" hints=$withval fi; if test "$hints" = ""; then host=`hostname | sed 's/\..*//'` if test -r $host.hints; then hints=$host.hints else if test -r ../$host.hints; then hints=../$host.hints fi fi fi if test "$hints" = ""; then sys=`uname -s` if test -r $sys.hints; then hints=$sys.hints else if test -r ../$sys.hints; then hints=../$sys.hints fi fi fi if test "$hints" != ""; then echo "$as_me:$LINENO: result: reading hints from $hints" >&5 echo "${ECHO_T}reading hints from $hints" >&6 . $hints fi ######### # Locate a compiler for the build machine. This compiler should # generate command-line programs that run on the build machine. # default_build_cflags="-g" if test "$config_BUILD_CC" = ""; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = "yes"; then { { echo "$as_me:$LINENO: error: unable to find a compiler for building build tools" >&5 echo "$as_me: error: unable to find a compiler for building build tools" >&2;} { (exit 1); exit 1; }; } fi BUILD_CC=$CC default_build_cflags=$CFLAGS else BUILD_CC=$config_BUILD_CC echo "$as_me:$LINENO: checking host compiler" >&5 echo $ECHO_N "checking host compiler... $ECHO_C" >&6 CC=$BUILD_CC echo "$as_me:$LINENO: result: $BUILD_CC" >&5 echo "${ECHO_T}$BUILD_CC" >&6 fi echo "$as_me:$LINENO: checking switches for the host compiler" >&5 echo $ECHO_N "checking switches for the host compiler... $ECHO_C" >&6 if test "$config_BUILD_CFLAGS" != ""; then CFLAGS=$config_BUILD_CFLAGS BUILD_CFLAGS=$config_BUILD_CFLAGS else BUILD_CFLAGS=$default_build_cflags fi echo "$as_me:$LINENO: result: $BUILD_CFLAGS" >&5 echo "${ECHO_T}$BUILD_CFLAGS" >&6 if test "$config_BUILD_LIBS" != ""; then BUILD_LIBS=$config_BUILD_LIBS fi ########## # Locate a compiler that converts C code into *.o files that run on # the target machine. # echo "$as_me:$LINENO: checking target compiler" >&5 echo $ECHO_N "checking target compiler... $ECHO_C" >&6 if test "$config_TARGET_CC" != ""; then TARGET_CC=$config_TARGET_CC else TARGET_CC=$BUILD_CC fi echo "$as_me:$LINENO: result: $TARGET_CC" >&5 echo "${ECHO_T}$TARGET_CC" >&6 echo "$as_me:$LINENO: checking switches on the target compiler" >&5 echo $ECHO_N "checking switches on the target compiler... $ECHO_C" >&6 if test "$config_TARGET_CFLAGS" != ""; then TARGET_CFLAGS=$config_TARGET_CFLAGS else TARGET_CFLAGS=$BUILD_CFLAGS fi echo "$as_me:$LINENO: result: $TARGET_CFLAGS" >&5 echo "${ECHO_T}$TARGET_CFLAGS" >&6 echo "$as_me:$LINENO: checking target linker" >&5 echo $ECHO_N "checking target linker... $ECHO_C" >&6 if test "$config_TARGET_LINK" = ""; then TARGET_LINK=$TARGET_CC else TARGET_LINK=$config_TARGET_LINK fi echo "$as_me:$LINENO: result: $TARGET_LINK" >&5 echo "${ECHO_T}$TARGET_LINK" >&6 echo "$as_me:$LINENO: checking switches on the target compiler" >&5 echo $ECHO_N "checking switches on the target compiler... $ECHO_C" >&6 if test "$config_TARGET_TFLAGS" != ""; then TARGET_TFLAGS=$config_TARGET_TFLAGS else TARGET_TFLAGS=$BUILD_CFLAGS fi if test "$config_TARGET_RANLIB" != ""; then TARGET_RANLIB=$config_TARGET_RANLIB else if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi TARGET_RANLIB=$RANLIB fi if test "$config_TARGET_AR" != ""; then TARGET_AR=$config_TARGET_AR else TARGET_AR='ar cr' fi echo "$as_me:$LINENO: result: $TARGET_TFLAGS" >&5 echo "${ECHO_T}$TARGET_TFLAGS" >&6 # Set the $cross variable if we are cross-compiling. Make # it 0 if we are not. # echo "$as_me:$LINENO: checking if host and target compilers are the same" >&5 echo $ECHO_N "checking if host and target compilers are the same... $ECHO_C" >&6 if test "$BUILD_CC" = "$TARGET_CC"; then cross=0 echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else cross=1 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ########## # Are we using UTF-8 or iso8859 encodings? # # Check whether --enable-utf8 or --disable-utf8 was given. if test "${enable_utf8+set}" = set; then enableval="$enable_utf8" else enable_utf8=no fi; echo "$as_me:$LINENO: checking character encoding" >&5 echo $ECHO_N "checking character encoding... $ECHO_C" >&6 if test "$enable_utf8" = "no"; then ENCODING=ISO8859 echo "$as_me:$LINENO: result: iso8859" >&5 echo "${ECHO_T}iso8859" >&6 else ENCODING=UTF8 echo "$as_me:$LINENO: result: UTF-8" >&5 echo "${ECHO_T}UTF-8" >&6 fi ########## # Do we want to support in-ram databases for ATTACH DATABASE and sqlite_open # # Check whether --enable-incore-db or --disable-incore-db was given. if test "${enable_incore_db+set}" = set; then enableval="$enable_incore_db" else enable_incore_db=yes fi; echo "$as_me:$LINENO: checking whether to support incore databases for attach and open" >&5 echo $ECHO_N "checking whether to support incore databases for attach and open... $ECHO_C" >&6 if test "$enable_incore_db" = "no"; then INMEMORYDB=0 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else INMEMORYDB=1 echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 fi ########## # Do we want to support release # # Check whether --enable-releasemode or --disable-releasemode was given. if test "${enable_releasemode+set}" = set; then enableval="$enable_releasemode" else enable_releasemode=no fi; echo "$as_me:$LINENO: checking whether to support shared library linked as release mode or not" >&5 echo $ECHO_N "checking whether to support shared library linked as release mode or not... $ECHO_C" >&6 if test "$enable_releasemode" = "no"; then ALLOWRELEASE="" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else ALLOWRELEASE="-release `cat VERSION`" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 fi ########## # Do we want temporary databases in memory # # Check whether --enable-tempdb-in-ram or --disable-tempdb-in-ram was given. if test "${enable_tempdb_in_ram+set}" = set; then enableval="$enable_tempdb_in_ram" else enable_tempdb_in_ram=no fi; echo "$as_me:$LINENO: checking whether to use an in-ram database for temporary tables" >&5 echo $ECHO_N "checking whether to use an in-ram database for temporary tables... $ECHO_C" >&6 case "$enable_tempdb_in_ram" in never ) TEMP_STORE=0 echo "$as_me:$LINENO: result: never" >&5 echo "${ECHO_T}never" >&6 ;; no ) INMEMORYDB=1 TEMP_STORE=1 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; always ) INMEMORYDB=1 TEMP_STORE=3 echo "$as_me:$LINENO: result: always" >&5 echo "${ECHO_T}always" >&6 ;; * ) INMEMORYDB=1 TEMP_STORE=2 echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; esac ########### # Lots of things are different if we are compiling for Windows using # the CYGWIN environment. So check for that special case and handle # things accordingly. # echo "$as_me:$LINENO: checking if executables have the .exe suffix" >&5 echo $ECHO_N "checking if executables have the .exe suffix... $ECHO_C" >&6 if test "$config_BUILD_EXEEXT" = ".exe"; then CYGWIN=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: unknown" >&5 echo "${ECHO_T}unknown" >&6 fi if test "$CYGWIN" != "yes"; then case $host_os in *cygwin* ) CYGWIN=yes;; * ) CYGWIN=no;; esac fi if test "$CYGWIN" = "yes"; then BUILD_EXEEXT=.exe else BUILD_EXEEXT=$EXEEXT fi if test "$cross" = "0"; then TARGET_EXEEXT=$BUILD_EXEEXT else TARGET_EXEEXT=$config_TARGET_EXEEXT fi if test "$TARGET_EXEEXT" = ".exe"; then OS_UNIX=0 OS_WIN=1 tclsubdir=win else OS_UNIX=1 OS_WIN=0 tclsubdir=unix fi TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=$OS_UNIX -DOS_WIN=$OS_WIN" ########## # Extract generic linker options from the environment. # if test "$config_TARGET_LIBS" != ""; then TARGET_LIBS=$config_TARGET_LIBS else TARGET_LIBS="" fi ########## # Figure out what C libraries are required to compile Tcl programs. # if test "$config_TARGET_TCL_LIBS" != ""; then TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS" else if test "$with_tcl" != ""; then extra=`echo $with_tcl/$tclsubdir/libtcl8*.a` fi CC=$TARGET_CC echo "$as_me:$LINENO: checking for sin" >&5 echo $ECHO_N "checking for sin... $ECHO_C" >&6 if test "${ac_cv_func_sin+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define sin to an innocuous variant, in case declares sin. For example, HP-UX 11i declares gettimeofday. */ #define sin innocuous_sin /* System header to define __stub macros and hopefully few prototypes, which can conflict with char sin (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef sin /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char sin (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_sin) || defined (__stub___sin) choke me #else char (*f) () = sin; #endif #ifdef __cplusplus } #endif int main () { return f != sin; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_sin=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_sin=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 echo "${ECHO_T}$ac_cv_func_sin" >&6 if test $ac_cv_func_sin = yes; then LIBS="" else LIBS="-lm" fi echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF LIBS="-ldl $LIBS" fi otherlibs=$LIBS if test "$extra" != ""; then LIBS=$extra else LIBS="" echo "$as_me:$LINENO: checking for library containing Tcl_Init" >&5 echo $ECHO_N "checking for library containing Tcl_Init... $ECHO_C" >&6 if test "${ac_cv_search_Tcl_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_Tcl_Init=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char Tcl_Init (); int main () { Tcl_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_Tcl_Init="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_Tcl_Init" = no; then for ac_lib in tcl8.4 tcl8.3 tcl84 tcl83 tcl; do LIBS="-l$ac_lib $otherlibs $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char Tcl_Init (); int main () { Tcl_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_Tcl_Init="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_Tcl_Init" >&5 echo "${ECHO_T}$ac_cv_search_Tcl_Init" >&6 if test "$ac_cv_search_Tcl_Init" != no; then test "$ac_cv_search_Tcl_Init" = "none required" || LIBS="$ac_cv_search_Tcl_Init $LIBS" fi fi TARGET_TCL_LIBS="$LIBS $otherlibs" fi ########## # Figure out where to get the TCL header files. # echo "$as_me:$LINENO: checking TCL header files" >&5 echo $ECHO_N "checking TCL header files... $ECHO_C" >&6 found=no if test "$config_TARGET_TCL_INC" != ""; then TARGET_TCL_INC=$config_TARGET_TCL_INC found=yes else if test "$with_tcl" != ""; then TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir" found=yes else TARGET_TCL_INC="" found=no fi fi if test "$found" = "yes"; then echo "$as_me:$LINENO: result: $TARGET_TCL_INC" >&5 echo "${ECHO_T}$TARGET_TCL_INC" >&6 else echo "$as_me:$LINENO: result: not specified: still searching..." >&5 echo "${ECHO_T}not specified: still searching..." >&6 if test "${ac_cv_header_tcl_h+set}" = set; then echo "$as_me:$LINENO: checking for tcl.h" >&5 echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6 if test "${ac_cv_header_tcl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_tcl_h" >&5 echo "${ECHO_T}$ac_cv_header_tcl_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking tcl.h usability" >&5 echo $ECHO_N "checking tcl.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking tcl.h presence" >&5 echo $ECHO_N "checking tcl.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: tcl.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: tcl.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: tcl.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: tcl.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: tcl.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: tcl.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: tcl.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for tcl.h" >&5 echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6 if test "${ac_cv_header_tcl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_tcl_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_tcl_h" >&5 echo "${ECHO_T}$ac_cv_header_tcl_h" >&6 fi if test $ac_cv_header_tcl_h = yes; then found=yes fi fi if test "$found" = "no"; then for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do as_ac_File=`echo "ac_cv_file_$dir/include/tcl.h" | $as_tr_sh` echo "$as_me:$LINENO: checking for $dir/include/tcl.h" >&5 echo $ECHO_N "checking for $dir/include/tcl.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_File+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$dir/include/tcl.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6 if test `eval echo '${'$as_ac_File'}'` = yes; then found=yes fi if test "$found" = "yes"; then TARGET_TCL_INC="-I$dir/include" break fi done fi if test "$found" = "no"; then TARGET_TCL_INC="-DNO_TCL=1" fi ########## # Figure out what C libraries are required to compile programs # that use "readline()" library. # if test "$config_TARGET_READLINE_LIBS" != ""; then TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS" else CC=$TARGET_CC LIBS="" echo "$as_me:$LINENO: checking for library containing tgetent" >&5 echo $ECHO_N "checking for library containing tgetent... $ECHO_C" >&6 if test "${ac_cv_search_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_tgetent=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); int main () { tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tgetent="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_tgetent" = no; then for ac_lib in readline ncurses curses termcap; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); int main () { tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tgetent="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_tgetent" >&5 echo "${ECHO_T}$ac_cv_search_tgetent" >&6 if test "$ac_cv_search_tgetent" != no; then test "$ac_cv_search_tgetent" = "none required" || LIBS="$ac_cv_search_tgetent $LIBS" fi echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6 if test "${ac_cv_lib_readline_readline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char readline (); int main () { readline (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_readline_readline=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_readline=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6 if test $ac_cv_lib_readline_readline = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBREADLINE 1 _ACEOF LIBS="-lreadline $LIBS" fi TARGET_READLINE_LIBS="$LIBS" fi ########## # Figure out where to get the READLINE header files. # echo "$as_me:$LINENO: checking readline header files" >&5 echo $ECHO_N "checking readline header files... $ECHO_C" >&6 found=no if test "$config_TARGET_READLINE_INC" != ""; then TARGET_READLINE_INC=$config_TARGET_READLINE_INC found=yes fi if test "$found" = "yes"; then echo "$as_me:$LINENO: result: $TARGET_READLINE_INC" >&5 echo "${ECHO_T}$TARGET_READLINE_INC" >&6 else echo "$as_me:$LINENO: result: not specified: still searching..." >&5 echo "${ECHO_T}not specified: still searching..." >&6 if test "${ac_cv_header_readline_h+set}" = set; then echo "$as_me:$LINENO: checking for readline.h" >&5 echo $ECHO_N "checking for readline.h... $ECHO_C" >&6 if test "${ac_cv_header_readline_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_readline_h" >&5 echo "${ECHO_T}$ac_cv_header_readline_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking readline.h usability" >&5 echo $ECHO_N "checking readline.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking readline.h presence" >&5 echo $ECHO_N "checking readline.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: readline.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: readline.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: readline.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: readline.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: readline.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: readline.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: readline.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: readline.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: readline.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: readline.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: readline.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: readline.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: readline.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: readline.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: readline.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: readline.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for readline.h" >&5 echo $ECHO_N "checking for readline.h... $ECHO_C" >&6 if test "${ac_cv_header_readline_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_readline_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_readline_h" >&5 echo "${ECHO_T}$ac_cv_header_readline_h" >&6 fi if test $ac_cv_header_readline_h = yes; then found=yes fi fi if test "$found" = "no"; then for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do as_ac_File=`echo "ac_cv_file_$dir/include/readline.h" | $as_tr_sh` echo "$as_me:$LINENO: checking for $dir/include/readline.h" >&5 echo $ECHO_N "checking for $dir/include/readline.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_File+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$dir/include/readline.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6 if test `eval echo '${'$as_ac_File'}'` = yes; then found=yes fi if test "$found" = "yes"; then TARGET_READLINE_INC="-I$dir/include" break fi as_ac_File=`echo "ac_cv_file_$dir/include/readline/readline.h" | $as_tr_sh` echo "$as_me:$LINENO: checking for $dir/include/readline/readline.h" >&5 echo $ECHO_N "checking for $dir/include/readline/readline.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_File+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$dir/include/readline/readline.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6 if test `eval echo '${'$as_ac_File'}'` = yes; then found=yes fi if test "$found" = "yes"; then TARGET_READLINE_INC="-I$dir/include/readline" break fi done fi if test "$found" = "yes"; then if test "$TARGET_READLINE_LIBS" = ""; then TARGET_HAVE_READLINE=0 else TARGET_HAVE_READLINE=1 fi else TARGET_HAVE_READLINE=0 fi ######### # Figure out whether or not we have a "usleep()" function. # echo "$as_me:$LINENO: checking for usleep" >&5 echo $ECHO_N "checking for usleep... $ECHO_C" >&6 if test "${ac_cv_func_usleep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define usleep to an innocuous variant, in case declares usleep. For example, HP-UX 11i declares gettimeofday. */ #define usleep innocuous_usleep /* System header to define __stub macros and hopefully few prototypes, which can conflict with char usleep (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef usleep /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char usleep (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_usleep) || defined (__stub___usleep) choke me #else char (*f) () = usleep; #endif #ifdef __cplusplus } #endif int main () { return f != usleep; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_usleep=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_usleep=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_usleep" >&5 echo "${ECHO_T}$ac_cv_func_usleep" >&6 if test $ac_cv_func_usleep = yes; then TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1" fi ######### # Generate the output files. # ac_config_files="$ac_config_files Makefile sqlite.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "sqlite.pc" ) CONFIG_FILES="$CONFIG_FILES sqlite.pc" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@CPP@,$CPP,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@CXXCPP@,$CXXCPP,;t t s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@program_prefix@,$program_prefix,;t t s,@VERSION@,$VERSION,;t t s,@BUILD_CC@,$BUILD_CC,;t t s,@BUILD_CFLAGS@,$BUILD_CFLAGS,;t t s,@BUILD_LIBS@,$BUILD_LIBS,;t t s,@TARGET_CC@,$TARGET_CC,;t t s,@TARGET_CFLAGS@,$TARGET_CFLAGS,;t t s,@TARGET_LINK@,$TARGET_LINK,;t t s,@TARGET_LFLAGS@,$TARGET_LFLAGS,;t t s,@TARGET_RANLIB@,$TARGET_RANLIB,;t t s,@TARGET_AR@,$TARGET_AR,;t t s,@ENCODING@,$ENCODING,;t t s,@ALLOWATTACHMEM@,$ALLOWATTACHMEM,;t t s,@ALLOWRELEASE@,$ALLOWRELEASE,;t t s,@INMEMORYDB@,$INMEMORYDB,;t t s,@TEMP_STORE@,$TEMP_STORE,;t t s,@BUILD_EXEEXT@,$BUILD_EXEEXT,;t t s,@OS_UNIX@,$OS_UNIX,;t t s,@OS_WIN@,$OS_WIN,;t t s,@TARGET_EXEEXT@,$TARGET_EXEEXT,;t t s,@TARGET_LIBS@,$TARGET_LIBS,;t t s,@TARGET_TCL_LIBS@,$TARGET_TCL_LIBS,;t t s,@TARGET_TCL_INC@,$TARGET_TCL_INC,;t t s,@TARGET_READLINE_LIBS@,$TARGET_READLINE_LIBS,;t t s,@TARGET_READLINE_INC@,$TARGET_READLINE_INC,;t t s,@TARGET_HAVE_READLINE@,$TARGET_HAVE_READLINE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi sqlite-2.8.17/main.mk0000644000175000001440000002774110232547613014341 0ustar drhusers00000000000000############################################################################### # The following macros should be defined before this script is # invoked: # # TOP The toplevel directory of the source tree. This is the # directory that contains this "Makefile.in" and the # "configure.in" script. # # BCC C Compiler and options for use in building executables that # will run on the platform that is doing the build. # # USLEEP If the target operating system supports the "usleep()" system # call, then define the HAVE_USLEEP macro for all C modules. # # THREADSAFE If you want the SQLite library to be safe for use within a # multi-threaded program, then define the following macro # appropriately: # # THREADLIB Specify any extra linker options needed to make the library # thread safe # # OPTS Extra compiler command-line options. # # EXE The suffix to add to executable files. ".exe" for windows # and "" for Unix. # # TCC C Compiler and options for use in building executables that # will run on the target platform. This is usually the same # as BCC, unless you are cross-compiling. # # AR Tools used to build a static library. # RANLIB # # TCL_FLAGS Extra compiler options needed for programs that use the # TCL library. # # LIBTCL Linker options needed to link against the TCL library. # # READLINE_FLAGS Compiler options needed for programs that use the # readline() library. # # LIBREADLINE Linker options needed by programs using readline() must # link against. # # ENCODING "UTF8" or "ISO8859" # # Once the macros above are defined, the rest of this make script will # build the SQLite library and testing tools. ################################################################################ # This is how we compile # TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src # Object files for the SQLite library. # LIBOBJ = attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \ expr.o func.o hash.o insert.o \ main.o opcodes.o os.o pager.o parse.o pragma.o printf.o random.o \ select.o table.o tokenize.o trigger.o update.o util.o \ vacuum.o vdbe.o vdbeaux.o where.o tclsqlite.o # All of the source code files. # SRC = \ $(TOP)/src/attach.c \ $(TOP)/src/auth.c \ $(TOP)/src/btree.c \ $(TOP)/src/btree.h \ $(TOP)/src/btree_rb.c \ $(TOP)/src/build.c \ $(TOP)/src/copy.c \ $(TOP)/src/date.c \ $(TOP)/src/delete.c \ $(TOP)/src/encode.c \ $(TOP)/src/expr.c \ $(TOP)/src/func.c \ $(TOP)/src/hash.c \ $(TOP)/src/hash.h \ $(TOP)/src/insert.c \ $(TOP)/src/main.c \ $(TOP)/src/os.c \ $(TOP)/src/pager.c \ $(TOP)/src/pager.h \ $(TOP)/src/parse.y \ $(TOP)/src/pragma.c \ $(TOP)/src/printf.c \ $(TOP)/src/random.c \ $(TOP)/src/select.c \ $(TOP)/src/shell.c \ $(TOP)/src/sqlite.h.in \ $(TOP)/src/sqliteInt.h \ $(TOP)/src/table.c \ $(TOP)/src/tclsqlite.c \ $(TOP)/src/tokenize.c \ $(TOP)/src/trigger.c \ $(TOP)/src/update.c \ $(TOP)/src/util.c \ $(TOP)/src/vacuum.c \ $(TOP)/src/vdbe.c \ $(TOP)/src/vdbe.h \ $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbeInt.h \ $(TOP)/src/where.c # Source code to the test files. # TESTSRC = \ $(TOP)/src/btree.c \ $(TOP)/src/func.c \ $(TOP)/src/os.c \ $(TOP)/src/pager.c \ $(TOP)/src/test1.c \ $(TOP)/src/test2.c \ $(TOP)/src/test3.c \ $(TOP)/src/test4.c \ $(TOP)/src/vdbe.c \ $(TOP)/src/md5.c # Header files used by all library source files. # HDR = \ sqlite.h \ $(TOP)/src/btree.h \ config.h \ $(TOP)/src/hash.h \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/sqliteInt.h \ $(TOP)/src/vdbe.h \ parse.h # Header files used by the VDBE submodule # VDBEHDR = \ $(HDR) \ $(TOP)/src/vdbeInt.h # 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 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 # last_change: $(SRC) cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \ | awk '{print $$5,$$6}' >last_change libsqlite.a: $(LIBOBJ) $(AR) libsqlite.a $(LIBOBJ) $(RANLIB) libsqlite.a sqlite$(EXE): $(TOP)/src/shell.c libsqlite.a sqlite.h $(TCCX) $(READLINE_FLAGS) -o sqlite$(EXE) $(TOP)/src/shell.c \ libsqlite.a $(LIBREADLINE) $(THREADLIB) sqlite_analyzer$(EXE): $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC) \ $(TOP)/tool/spaceanal.tcl sed \ -e '/^#/d' \ -e 's,\\,\\\\,g' \ -e 's,",\\",g' \ -e 's,^,",' \ -e 's,$$,\\n",' \ $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -static -o \ sqlite_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \ libsqlite.a $(LIBTCL) # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # target_source: $(SRC) $(VDBEHDR) opcodes.c rm -rf tsrc mkdir tsrc cp $(SRC) $(VDBEHDR) tsrc rm tsrc/sqlite.h.in tsrc/parse.y cp parse.c opcodes.c tsrc # Rules to build the LEMON compiler generator # lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c $(BCC) -o lemon $(TOP)/tool/lemon.c cp $(TOP)/tool/lempar.c . btree.o: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h $(TCCX) -c $(TOP)/src/btree.c btree_rb.o: $(TOP)/src/btree_rb.c $(HDR) $(TCCX) -c $(TOP)/src/btree_rb.c build.o: $(TOP)/src/build.c $(HDR) $(TCCX) -c $(TOP)/src/build.c main.o: $(TOP)/src/main.c $(HDR) $(TCCX) -c $(TOP)/src/main.c pager.o: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h $(TCCX) -c $(TOP)/src/pager.c opcodes.o: opcodes.c $(TCCX) -c opcodes.c opcodes.c: $(TOP)/src/vdbe.c echo '/* Automatically generated file. Do not edit */' >opcodes.c echo 'char *sqliteOpcodeNames[] = { "???", ' >>opcodes.c grep '^case OP_' $(TOP)/src/vdbe.c | \ sed -e 's/^.*OP_/ "/' -e 's/:.*$$/", /' >>opcodes.c echo '};' >>opcodes.c opcodes.h: $(TOP)/src/vdbe.h echo '/* Automatically generated file. Do not edit */' >opcodes.h grep '^case OP_' $(TOP)/src/vdbe.c | \ sed -e 's/://' | \ awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h os.o: $(TOP)/src/os.c $(HDR) $(TCCX) -c $(TOP)/src/os.c parse.o: parse.c $(HDR) $(TCCX) -c parse.c parse.h: parse.c 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",sizeof(char*));' >>temp.c echo 'exit(0);}' >>temp.c $(BCC) -o temp temp.c ./temp >config.h echo >>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)/ \ $(TOP)/src/sqlite.h.in >sqlite.h tokenize.o: $(TOP)/src/tokenize.c $(HDR) $(TCCX) -c $(TOP)/src/tokenize.c trigger.o: $(TOP)/src/trigger.c $(HDR) $(TCCX) -c $(TOP)/src/trigger.c util.o: $(TOP)/src/util.c $(HDR) $(TCCX) -c $(TOP)/src/util.c vacuum.o: $(TOP)/src/vacuum.c $(HDR) $(TCCX) -c $(TOP)/src/vacuum.c vdbe.o: $(TOP)/src/vdbe.c $(VDBEHDR) $(TCCX) -c $(TOP)/src/vdbe.c vdbeaux.o: $(TOP)/src/vdbeaux.c $(VDBEHDR) $(TCCX) -c $(TOP)/src/vdbeaux.c where.o: $(TOP)/src/where.c $(HDR) $(TCCX) -c $(TOP)/src/where.c copy.o: $(TOP)/src/copy.c $(HDR) $(TCCX) -c $(TOP)/src/copy.c date.o: $(TOP)/src/date.c $(HDR) $(TCCX) -c $(TOP)/src/date.c delete.o: $(TOP)/src/delete.c $(HDR) $(TCCX) -c $(TOP)/src/delete.c encode.o: $(TOP)/src/encode.c $(TCCX) -c $(TOP)/src/encode.c expr.o: $(TOP)/src/expr.c $(HDR) $(TCCX) -c $(TOP)/src/expr.c func.o: $(TOP)/src/func.c $(HDR) $(TCCX) -c $(TOP)/src/func.c hash.o: $(TOP)/src/hash.c $(HDR) $(TCCX) -c $(TOP)/src/hash.c insert.o: $(TOP)/src/insert.c $(HDR) $(TCCX) -c $(TOP)/src/insert.c random.o: $(TOP)/src/random.c $(HDR) $(TCCX) -c $(TOP)/src/random.c select.o: $(TOP)/src/select.c $(HDR) $(TCCX) -c $(TOP)/src/select.c table.o: $(TOP)/src/table.c $(HDR) $(TCCX) -c $(TOP)/src/table.c update.o: $(TOP)/src/update.c $(HDR) $(TCCX) -c $(TOP)/src/update.c tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c pragma.o: $(TOP)/src/pragma.c $(HDR) $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/pragma.c printf.o: $(TOP)/src/printf.c $(HDR) $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/printf.c attach.o: $(TOP)/src/attach.c $(HDR) $(TCCX) -c $(TOP)/src/attach.c auth.o: $(TOP)/src/auth.c $(HDR) $(TCCX) -c $(TOP)/src/auth.c tclsqlite: $(TOP)/src/tclsqlite.c libsqlite.a $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite \ $(TOP)/src/tclsqlite.c libsqlite.a $(LIBTCL) testfixture$(EXE): $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC) $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1 -o testfixture$(EXE) \ $(TESTSRC) $(TOP)/src/tclsqlite.c \ libsqlite.a $(LIBTCL) $(THREADLIB) fulltest: testfixture$(EXE) sqlite$(EXE) ./testfixture$(EXE) $(TOP)/test/all.test test: testfixture$(EXE) sqlite$(EXE) ./testfixture$(EXE) $(TOP)/test/quick.test index.html: $(TOP)/www/index.tcl last_change tclsh $(TOP)/www/index.tcl `cat $(TOP)/VERSION` >index.html sqlite.html: $(TOP)/www/sqlite.tcl tclsh $(TOP)/www/sqlite.tcl >sqlite.html c_interface.html: $(TOP)/www/c_interface.tcl tclsh $(TOP)/www/c_interface.tcl >c_interface.html changes.html: $(TOP)/www/changes.tcl tclsh $(TOP)/www/changes.tcl >changes.html lang.html: $(TOP)/www/lang.tcl tclsh $(TOP)/www/lang.tcl >lang.html vdbe.html: $(TOP)/www/vdbe.tcl tclsh $(TOP)/www/vdbe.tcl >vdbe.html arch.html: $(TOP)/www/arch.tcl tclsh $(TOP)/www/arch.tcl >arch.html arch.png: $(TOP)/www/arch.png cp $(TOP)/www/arch.png . opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html mingw.html: $(TOP)/www/mingw.tcl tclsh $(TOP)/www/mingw.tcl >mingw.html tclsqlite.html: $(TOP)/www/tclsqlite.tcl tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html speed.html: $(TOP)/www/speed.tcl tclsh $(TOP)/www/speed.tcl >speed.html faq.html: $(TOP)/www/faq.tcl tclsh $(TOP)/www/faq.tcl >faq.html formatchng.html: $(TOP)/www/formatchng.tcl tclsh $(TOP)/www/formatchng.tcl >formatchng.html conflict.html: $(TOP)/www/conflict.tcl tclsh $(TOP)/www/conflict.tcl >conflict.html download.html: $(TOP)/www/download.tcl tclsh $(TOP)/www/download.tcl >download.html omitted.html: $(TOP)/www/omitted.tcl tclsh $(TOP)/www/omitted.tcl >omitted.html datatypes.html: $(TOP)/www/datatypes.tcl tclsh $(TOP)/www/datatypes.tcl >datatypes.html quickstart.html: $(TOP)/www/quickstart.tcl tclsh $(TOP)/www/quickstart.tcl >quickstart.html fileformat.html: $(TOP)/www/fileformat.tcl tclsh $(TOP)/www/fileformat.tcl >fileformat.html nulls.html: $(TOP)/www/nulls.tcl tclsh $(TOP)/www/nulls.tcl >nulls.html # Files to be published on the website. # DOC = \ index.html \ sqlite.html \ changes.html \ lang.html \ opcode.html \ arch.html \ arch.png \ vdbe.html \ c_interface.html \ mingw.html \ tclsqlite.html \ download.html \ speed.html \ faq.html \ formatchng.html \ conflict.html \ omitted.html \ datatypes.html \ quickstart.html \ fileformat.html \ nulls.html doc: $(DOC) mkdir -p doc mv $(DOC) doc install: sqlite libsqlite.a sqlite.h mv sqlite /usr/bin mv libsqlite.a /usr/lib mv sqlite.h /usr/include clean: rm -f *.o sqlite libsqlite.a sqlite.h opcodes.* rm -f lemon lempar.c parse.* sqlite*.tar.gz rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out rm -rf tsrc sqlite-2.8.17/configure.ac0000644000175000001440000003424110232547613015343 0ustar drhusers00000000000000# # This file describes a "configure" script that is used to build # makefiles for a particular platform. Process this file using # Autoconf version 1.13 in order to generate that script. All # lines of this file up to the AC_INIT macro are ignored. # # The build process allows for using a cross-compiler. But the default # action is to target the same platform that we are running on. The # configure script needs to discover the following properties of the # build and target systems: # # srcdir # # The is the name of the directory that contains the # "configure" shell script. All source files are # located relative to this directory. # # bindir # # The name of the directory where executables should be # written by the "install" target of the makefile. # # program_prefix # # Add this prefix to the names of all executables that run # on the target machine. Default: "" # # ENABLE_SHARED # # True if shared libraries should be generated. # # BUILD_CC # # The name of a command that is used to convert C # source files into executables that run on the build # platform. # # BUILD_CFLAGS # # Switches that the build compiler needs in order to construct # command-line programs. # # BUILD_LIBS # # Libraries that the build compiler needs in order to construct # command-line programs. # # BUILD_EXEEXT # # The filename extension for executables on the build # platform. "" for Unix and ".exe" for Windows. # # TARGET_CC # # The name of a command that runs on the build platform # and converts C source files into *.o files for the # target platform. In other words, the cross-compiler. # # TARGET_CFLAGS # # Switches that the target compiler needs to turn C source files # into *.o files. Do not include TARGET_TCL_INC in this list. # Makefiles might add additional switches such as "-I.". # # TARGET_TCL_LIBS # # This is the library directives passed to the target linker # that cause the executable to link against Tcl. This might # be a switch like "-ltcl8.0" or pathnames of library file # like "../../src/libtcl8.0.a". # # TARGET_TCL_INC # # This variables define the directory that contain header # files for Tcl. If the compiler is able to find # on its own, then this can be blank. # # TARGET_READLINE_LIBS # # This is the library directives passed to the target linker # that cause the executable to link against the readline library. # This might be a switch like "-lreadline" or pathnames of library # file like "../../src/libreadline.a". # # TARGET_READLINE_INC # # This variables define the directory that contain header # files for the readline library. If the compiler is able # to find on its own, then this can be blank. # # TARGET_LINK # # The name of the linker that combines *.o files generated # by TARGET_CC into executables for the target platform. # # TARGET_LIBS # # Additional libraries or other switch that the target linker needs # to build an executable on the target. Do not include # on this list any libraries in TARGET_TCL_LIBS and # TARGET_READLINE_LIBS, etc. # # TARGET_EXEEXT # # The filename extension for executables on the # target platform. "" for Unix and ".exe" for windows. # # The generated configure script will make an attempt to guess # at all of the above parameters. You can override any of # the guesses by setting the environment variable named # "config_AAAA" where "AAAA" is the name of the parameter # described above. (Exception: srcdir cannot be set this way.) # If you have a file that sets one or more of these environment # variables, you can invoke configure as follows: # # configure --with-hints=FILE # # where FILE is the name of the file that sets the environment # variables. FILE should be an absolute pathname. # # If you have a Tcl/Tk/BLT source distribution available, then the # files in that distribution will be used instead of any other # Tcl/Tk/BLT files the script might discover if you tell the configure # script about the source tree. Use commandline options: # # --with-tcl=PATH --with-tk=PATH --with-blt=PATH # # Or set environment variables config_WITH_TCL, config_WITH_TK, or # config_WITH_BLT. # # This configure.in file is easy to reuse on other projects. Just # change the argument to AC_INIT(). And disable any features that # you don't need (for example BLT) by erasing or commenting out # the corresponding code. # AC_INIT(src/sqlite.h.in) dnl Put the RCS revision string after AC_INIT so that it will also dnl show in in configure. # The following RCS revision string applies to configure.in # $Revision: 1.7 $ ######### # Programs needed # AC_PROG_LIBTOOL AC_PROG_INSTALL ######### # Set up an appropriate program prefix # if test "$program_prefix" = "NONE"; then program_prefix="" fi AC_SUBST(program_prefix) if test -f VERSION; then VERSION=`cat VERSION` echo "Version set to $VERSION" fi AC_SUBST(VERSION) ######### # Check to see if the --with-hints=FILE option is used. If there is none, # then check for a files named "$host.hints" and ../$hosts.hints where # $host is the hostname of the build system. If still no hints are # found, try looking in $system.hints and ../$system.hints where # $system is the result of uname -s. # AC_ARG_WITH(hints, [ --with-hints=FILE Read configuration options from FILE], hints=$withval) if test "$hints" = ""; then host=`hostname | sed 's/\..*//'` if test -r $host.hints; then hints=$host.hints else if test -r ../$host.hints; then hints=../$host.hints fi fi fi if test "$hints" = ""; then sys=`uname -s` if test -r $sys.hints; then hints=$sys.hints else if test -r ../$sys.hints; then hints=../$sys.hints fi fi fi if test "$hints" != ""; then AC_MSG_RESULT(reading hints from $hints) . $hints fi ######### # Locate a compiler for the build machine. This compiler should # generate command-line programs that run on the build machine. # default_build_cflags="-g" if test "$config_BUILD_CC" = ""; then AC_PROG_CC if test "$cross_compiling" = "yes"; then AC_MSG_ERROR([unable to find a compiler for building build tools]) fi BUILD_CC=$CC default_build_cflags=$CFLAGS else BUILD_CC=$config_BUILD_CC AC_MSG_CHECKING([host compiler]) CC=$BUILD_CC AC_MSG_RESULT($BUILD_CC) fi AC_MSG_CHECKING([switches for the host compiler]) if test "$config_BUILD_CFLAGS" != ""; then CFLAGS=$config_BUILD_CFLAGS BUILD_CFLAGS=$config_BUILD_CFLAGS else BUILD_CFLAGS=$default_build_cflags fi AC_MSG_RESULT($BUILD_CFLAGS) if test "$config_BUILD_LIBS" != ""; then BUILD_LIBS=$config_BUILD_LIBS fi AC_SUBST(BUILD_CC) AC_SUBST(BUILD_CFLAGS) AC_SUBST(BUILD_LIBS) ########## # Locate a compiler that converts C code into *.o files that run on # the target machine. # AC_MSG_CHECKING([target compiler]) if test "$config_TARGET_CC" != ""; then TARGET_CC=$config_TARGET_CC else TARGET_CC=$BUILD_CC fi AC_MSG_RESULT($TARGET_CC) AC_MSG_CHECKING([switches on the target compiler]) if test "$config_TARGET_CFLAGS" != ""; then TARGET_CFLAGS=$config_TARGET_CFLAGS else TARGET_CFLAGS=$BUILD_CFLAGS fi AC_MSG_RESULT($TARGET_CFLAGS) AC_MSG_CHECKING([target linker]) if test "$config_TARGET_LINK" = ""; then TARGET_LINK=$TARGET_CC else TARGET_LINK=$config_TARGET_LINK fi AC_MSG_RESULT($TARGET_LINK) AC_MSG_CHECKING([switches on the target compiler]) if test "$config_TARGET_TFLAGS" != ""; then TARGET_TFLAGS=$config_TARGET_TFLAGS else TARGET_TFLAGS=$BUILD_CFLAGS fi if test "$config_TARGET_RANLIB" != ""; then TARGET_RANLIB=$config_TARGET_RANLIB else AC_PROG_RANLIB TARGET_RANLIB=$RANLIB fi if test "$config_TARGET_AR" != ""; then TARGET_AR=$config_TARGET_AR else TARGET_AR='ar cr' fi AC_MSG_RESULT($TARGET_TFLAGS) AC_SUBST(TARGET_CC) AC_SUBST(TARGET_CFLAGS) AC_SUBST(TARGET_LINK) AC_SUBST(TARGET_LFLAGS) AC_SUBST(TARGET_RANLIB) AC_SUBST(TARGET_AR) # Set the $cross variable if we are cross-compiling. Make # it 0 if we are not. # AC_MSG_CHECKING([if host and target compilers are the same]) if test "$BUILD_CC" = "$TARGET_CC"; then cross=0 AC_MSG_RESULT(yes) else cross=1 AC_MSG_RESULT(no) fi ########## # Are we using UTF-8 or iso8859 encodings? # AC_ARG_ENABLE(utf8, [ --enable-utf8 Use UTF-8 encodings],,enable_utf8=no) AC_MSG_CHECKING([character encoding]) if test "$enable_utf8" = "no"; then ENCODING=ISO8859 AC_MSG_RESULT([iso8859]) else ENCODING=UTF8 AC_MSG_RESULT([UTF-8]) fi AC_SUBST(ENCODING) ########## # Do we want to support in-ram databases for ATTACH DATABASE and sqlite_open # AC_ARG_ENABLE(incore-db, [ --enable-incore-db Support incore database],,enable_incore_db=yes) AC_MSG_CHECKING([whether to support incore databases for attach and open]) if test "$enable_incore_db" = "no"; then INMEMORYDB=0 AC_MSG_RESULT([no]) else INMEMORYDB=1 AC_MSG_RESULT([yes]) fi AC_SUBST(ALLOWATTACHMEM) ########## # Do we want to support release # AC_ARG_ENABLE(releasemode, [ --enable-releasemode Support libtool link to release mode],,enable_releasemode=no) AC_MSG_CHECKING([whether to support shared library linked as release mode or not]) if test "$enable_releasemode" = "no"; then ALLOWRELEASE="" AC_MSG_RESULT([no]) else ALLOWRELEASE="-release `cat VERSION`" AC_MSG_RESULT([yes]) fi AC_SUBST(ALLOWRELEASE) ########## # Do we want temporary databases in memory # AC_ARG_ENABLE(tempdb-in-ram, [ --enable-tempdb-in-ram Use an in-ram database for temporary tables],,enable_tempdb_in_ram=no) AC_MSG_CHECKING([whether to use an in-ram database for temporary tables]) case "$enable_tempdb_in_ram" in never ) TEMP_STORE=0 AC_MSG_RESULT([never]) ;; no ) INMEMORYDB=1 TEMP_STORE=1 AC_MSG_RESULT([no]) ;; always ) INMEMORYDB=1 TEMP_STORE=3 AC_MSG_RESULT([always]) ;; * ) INMEMORYDB=1 TEMP_STORE=2 AC_MSG_RESULT([yes]) ;; esac AC_SUBST(INMEMORYDB) AC_SUBST(TEMP_STORE) ########### # Lots of things are different if we are compiling for Windows using # the CYGWIN environment. So check for that special case and handle # things accordingly. # AC_MSG_CHECKING([if executables have the .exe suffix]) if test "$config_BUILD_EXEEXT" = ".exe"; then CYGWIN=yes AC_MSG_RESULT(yes) else AC_MSG_RESULT(unknown) fi if test "$CYGWIN" != "yes"; then AC_CYGWIN fi if test "$CYGWIN" = "yes"; then BUILD_EXEEXT=.exe else BUILD_EXEEXT=$EXEEXT fi if test "$cross" = "0"; then TARGET_EXEEXT=$BUILD_EXEEXT else TARGET_EXEEXT=$config_TARGET_EXEEXT fi if test "$TARGET_EXEEXT" = ".exe"; then OS_UNIX=0 OS_WIN=1 tclsubdir=win else OS_UNIX=1 OS_WIN=0 tclsubdir=unix fi TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=$OS_UNIX -DOS_WIN=$OS_WIN" AC_SUBST(BUILD_EXEEXT) AC_SUBST(OS_UNIX) AC_SUBST(OS_WIN) AC_SUBST(TARGET_EXEEXT) ########## # Extract generic linker options from the environment. # if test "$config_TARGET_LIBS" != ""; then TARGET_LIBS=$config_TARGET_LIBS else TARGET_LIBS="" fi AC_SUBST(TARGET_LIBS) ########## # Figure out what C libraries are required to compile Tcl programs. # if test "$config_TARGET_TCL_LIBS" != ""; then TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS" else if test "$with_tcl" != ""; then extra=`echo $with_tcl/$tclsubdir/libtcl8*.a` fi CC=$TARGET_CC AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm") AC_CHECK_LIB(dl, dlopen) otherlibs=$LIBS if test "$extra" != ""; then LIBS=$extra else LIBS="" AC_SEARCH_LIBS(Tcl_Init, dnl tcl8.4 tcl8.3 tcl84 tcl83 tcl,,,$otherlibs) fi TARGET_TCL_LIBS="$LIBS $otherlibs" fi AC_SUBST(TARGET_TCL_LIBS) ########## # Figure out where to get the TCL header files. # AC_MSG_CHECKING([TCL header files]) found=no if test "$config_TARGET_TCL_INC" != ""; then TARGET_TCL_INC=$config_TARGET_TCL_INC found=yes else if test "$with_tcl" != ""; then TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir" found=yes else TARGET_TCL_INC="" found=no fi fi if test "$found" = "yes"; then AC_MSG_RESULT($TARGET_TCL_INC) else AC_MSG_RESULT(not specified: still searching...) AC_CHECK_HEADER(tcl.h, [found=yes]) fi if test "$found" = "no"; then for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do AC_CHECK_FILE($dir/include/tcl.h, found=yes) if test "$found" = "yes"; then TARGET_TCL_INC="-I$dir/include" break fi done fi if test "$found" = "no"; then TARGET_TCL_INC="-DNO_TCL=1" fi AC_SUBST(TARGET_TCL_INC) ########## # Figure out what C libraries are required to compile programs # that use "readline()" library. # if test "$config_TARGET_READLINE_LIBS" != ""; then TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS" else CC=$TARGET_CC LIBS="" AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap]) AC_CHECK_LIB([readline], [readline]) TARGET_READLINE_LIBS="$LIBS" fi AC_SUBST(TARGET_READLINE_LIBS) ########## # Figure out where to get the READLINE header files. # AC_MSG_CHECKING([readline header files]) found=no if test "$config_TARGET_READLINE_INC" != ""; then TARGET_READLINE_INC=$config_TARGET_READLINE_INC found=yes fi if test "$found" = "yes"; then AC_MSG_RESULT($TARGET_READLINE_INC) else AC_MSG_RESULT(not specified: still searching...) AC_CHECK_HEADER(readline.h, [found=yes]) fi if test "$found" = "no"; then for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do AC_CHECK_FILE($dir/include/readline.h, found=yes) if test "$found" = "yes"; then TARGET_READLINE_INC="-I$dir/include" break fi AC_CHECK_FILE($dir/include/readline/readline.h, found=yes) if test "$found" = "yes"; then TARGET_READLINE_INC="-I$dir/include/readline" break fi done fi if test "$found" = "yes"; then if test "$TARGET_READLINE_LIBS" = ""; then TARGET_HAVE_READLINE=0 else TARGET_HAVE_READLINE=1 fi else TARGET_HAVE_READLINE=0 fi AC_SUBST(TARGET_READLINE_INC) AC_SUBST(TARGET_HAVE_READLINE) ######### # Figure out whether or not we have a "usleep()" function. # AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"]) ######### # Generate the output files. # AC_OUTPUT([ Makefile sqlite.pc ]) sqlite-2.8.17/config.guess0000644000175000001440000012364610232547613015402 0ustar drhusers00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-01-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pegasos:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha*:OpenVMS:*:*) echo alpha-hp-vms exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` # GNU/KFreeBSD systems have a "k" prefix to indicate we are using # FreeBSD's kernel, but not the complete OS. case ${LIBC} in gnu) kernel_only='k' ;; esac echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DRAGONFLY:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: sqlite-2.8.17/install-sh0000644000175000001440000001273610232547613015063 0ustar drhusers00000000000000#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 sqlite-2.8.17/sqlite.10000644000175000001440000001462610232547613014445 0ustar drhusers00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH SQLITE 1 "Mon Apr 15 23:49:17 2002" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME sqlite \- A command line interface for SQLite .SH SYNOPSIS .B sqlite .RI [ options ] " filename " [ SQL ] .SS SUMMARY .PP sqlite is a terminal-based front-end to the SQLite library. It enables you to type in queries interactively, issue them to SQLite and see the results. Alternatively, you can specify SQL code on the command-line. In addition it provides a number of meta-commands. .SH DESCRIPTION This manual page documents briefly the .B sqlite command. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. .SS GETTING STARTED .PP To start the sqlite program, just type "sqlite" followed by the name the file that holds the SQLite database. If the file does not exist, a new one is created automatically. The sqlite program will then prompt you to enter SQL. Type in SQL statements (terminated by a semicolon), press "Enter" and the SQL will be executed. For example, to create a new SQLite database named "ex1" with a single table named "tbl1", you might do this: .sp .nf $ sqlite ex1 SQLite version 2.0.0 Enter ".help" for instructions sqlite> create table tbl1(one varchar(10), two smallint); sqlite> insert into tbl1 values('hello!',10); sqlite> insert into tbl1 values('goodbye', 20); sqlite> select * from tbl1; hello!|10 goodbye|20 sqlite> .sp .fi .SS SQLITE META-COMMANDS .PP Most of the time, sqlite just reads lines of input and passes them on to the SQLite library for execution. But if an input line begins with a dot ("."), then that line is intercepted and interpreted by the sqlite program itself. These "dot commands" are typically used to change the output format of queries, or to execute certain prepackaged query statements. For a listing of the available dot commands, you can enter ".help" at any time. For example: .sp .nf .cc | sqlite> .help .dump ?TABLE? ... Dump the database in an text format .echo ON|OFF Turn command echo on or off .exit Exit this program .explain ON|OFF Turn output mode suitable for EXPLAIN on or off. "off" will revert to the output mode that was previously in effect .header(s) ON|OFF Turn display of headers on or off .help Show this message .indices TABLE Show names of all indices on TABLE .mode MODE Set mode to one of "line(s)", "column(s)", "insert", "list", or "html" .mode insert TABLE Generate SQL insert statements for TABLE .nullvalue STRING Print STRING instead of nothing for NULL data .output FILENAME Send output to FILENAME .output stdout Send output to the screen .prompt MAIN CONTINUE Replace the standard prompts "sqlite > " and " ...> " with the strings MAIN and CONTINUE CONTINUE is optional. .quit Exit this program .read FILENAME Execute SQL in FILENAME .reindex ?TABLE? Rebuild indices .schema ?TABLE? Show the CREATE statements .separator STRING Change separator string for "list" mode .show Show the current values for the following: .echo .explain .mode .nullvalue .output .separator .width .tables ?PATTERN? List names of tables matching a pattern .timeout MS Try opening locked tables for MS milliseconds .width NUM NUM ... Set column widths for "column" mode sqlite> |cc . .sp .fi .SH OPTIONS The program has the following options: .TP .BI \-init\ file Read in and process 'file', which contains "dot commands". You can use this file to initialize display settings. .TP .B \-html Set output mode to HTML. .TP .B \-list Set output mode to 'list'. .TP .B \-line Set output mode to 'line'. .TP .B \-column Set output mode to 'column'. .TP .BI \-separator\ separator Specify which output field separator for 'list' mode to use. Default is '|'. .TP .BI \-nullvalue\ string When a null is encountered, print 'string'. Default is no string. .TP .B \-[no]header Turn headers on or off. Default is off. .TP .B \-echo Print commands before execution. .SH OUTPUT MODE The SQLite program has different output modes, which define the way the output (from queries) is formatted. In 'list' mode, which is the default, one record per line is output, each field separated by the separator specified with the \fB-separator\fP option or \fB.separator\fP command. In 'line' mode, each column is output on its own line, records are separated by blank lines. In HTML mode, an XHTML table is generated. In 'column' mode, one record per line is output, aligned neatly in colums. .SH INIT FILE sqlite can be initialized using resource files. These can be combined with command line arguments to set up sqlite exactly the way you want it. Initialization proceeds as follows: o The defaults of .sp .nf .cc | mode = LIST separator = "|" main prompt = "sqlite> " continue prompt = " ...> " |cc . .sp .fi are established. o If a file .sqliterc can be found in the user's home directory, it is read and processed. It should only contain "dot commands". If the file is not found or cannot be read, processing continues without notification. o If a file is specified on the command line with the -init option, it is processed in the same manner as .sqliterc o All other command line options are processed o The database is opened and you are now ready to begin. .SH SEE ALSO http://www.hwaci.com/sw/sqlite/ .br The sqlite-doc package .SH AUTHOR This manual page was originally written by Andreas Rottmann , for the Debian GNU/Linux system (but may be used by others). sqlite-2.8.17/config.sub0000644000175000001440000007431510232547613015043 0ustar drhusers00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-01-05' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: sqlite-2.8.17/Makefile.in0000600000175000001440000003336410232547613015117 0ustar drhusers00000000000000#!/usr/make # # Makefile for SQLITE # # This makefile is suppose to be configured automatically using the # autoconf. But if that does not work for you, you can configure # the makefile manually. Just set the parameters below to values that # work well for your system. # # If the configure script does not work out-of-the-box, you might # be able to get it to work by giving it some hints. See the comment # at the beginning of configure.in for additional information. # # The toplevel directory of the source tree. This is the directory # that contains this "Makefile.in" and the "configure.in" script. # TOP = @srcdir@ # C Compiler and options for use in building executables that # will run on the platform that is doing the build. # BCC = @BUILD_CC@ @BUILD_CFLAGS@ # C Compile and options for use in building executables that # will run on the target platform. (BCC and TCC are usually the # same unless your are cross-compiling.) # TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src # Some standard variables and programs # prefix = @prefix@ exec_prefix = @exec_prefix@ INSTALL = @INSTALL@ LIBTOOL = ./libtool RELEASE = @ALLOWRELEASE@ # libtool compile/link/install LTCOMPILE = $(LIBTOOL) --mode=compile $(TCC) LTLINK = $(LIBTOOL) --mode=link $(TCC) LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) # Compiler options needed for programs that use the TCL library. # TCL_FLAGS = @TARGET_TCL_INC@ # The library that programs using TCL must link against. # LIBTCL = @TARGET_TCL_LIBS@ # Compiler options needed for programs that use the readline() library. # READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@ # The library that programs using readline() must link against. # LIBREADLINE = @TARGET_READLINE_LIBS@ # Should the database engine assume text is coded as UTF-8 or iso8859? # # ENCODING = UTF8 # ENCODING = ISO8859 ENCODING = @ENCODING@ # Flags controlling use of the in memory btree implementation # # SQLITE_OMIT_INMEMORYDB is defined in order to omit the in-memory # red/black tree driver in the file btree_rb.c # # TEMP_STORE is 0 to force temporary tables to be in a file, 1 to # default to file, 2 to default to memory, and 3 to force temporary # tables to always be in memory. # INMEMORYDB = @INMEMORYDB@ INCOREFLAGS = -DTEMP_STORE=@TEMP_STORE@ ifeq (${INMEMORYDB},0) INCOREFLAGS += -DSQLITE_OMIT_INMEMORYDB=1 endif # You should not have to change anything below this line ############################################################################### # Object files for the SQLite library. # LIBOBJ = attach.lo auth.lo btree.lo build.lo copy.lo date.lo \ delete.lo encode.lo expr.lo func.lo hash.lo insert.lo \ main.lo opcodes.lo os.lo pager.lo parse.lo pragma.lo \ printf.lo random.lo select.lo table.lo tokenize.lo \ update.lo util.lo vacuum.lo vdbe.lo vdbeaux.lo \ where.lo trigger.lo # Only build the in-core DB if it is required. ifeq (${INMEMORYDB},1) LIBOBJ += btree_rb.lo endif # All of the source code files. # SRC = \ $(TOP)/src/attach.c \ $(TOP)/src/auth.c \ $(TOP)/src/btree.c \ $(TOP)/src/btree.h \ $(TOP)/src/btree_rb.c \ $(TOP)/src/build.c \ $(TOP)/src/copy.c \ $(TOP)/src/date.c \ $(TOP)/src/delete.c \ $(TOP)/src/encode.c \ $(TOP)/src/expr.c \ $(TOP)/src/func.c \ $(TOP)/src/hash.c \ $(TOP)/src/hash.h \ $(TOP)/src/insert.c \ $(TOP)/src/main.c \ $(TOP)/src/os.c \ $(TOP)/src/pager.c \ $(TOP)/src/pager.h \ $(TOP)/src/parse.y \ $(TOP)/src/pragma.c \ $(TOP)/src/printf.c \ $(TOP)/src/random.c \ $(TOP)/src/select.c \ $(TOP)/src/shell.c \ $(TOP)/src/sqlite.h.in \ $(TOP)/src/sqliteInt.h \ $(TOP)/src/table.c \ $(TOP)/src/tclsqlite.c \ $(TOP)/src/tokenize.c \ $(TOP)/src/trigger.c \ $(TOP)/src/update.c \ $(TOP)/src/util.c \ $(TOP)/src/vacuum.c \ $(TOP)/src/vdbe.c \ $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbe.h \ $(TOP)/src/where.c # Source code to the test files. # TESTSRC = \ $(TOP)/src/btree.c \ $(TOP)/src/func.c \ $(TOP)/src/os.c \ $(TOP)/src/pager.c \ $(TOP)/src/test1.c \ $(TOP)/src/test2.c \ $(TOP)/src/test3.c \ $(TOP)/src/test4.c \ $(TOP)/src/vdbe.c \ $(TOP)/src/md5.c # Header files used by all library source files. # HDR = \ sqlite.h \ $(TOP)/src/btree.h \ config.h \ $(TOP)/src/hash.h \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/sqliteInt.h \ $(TOP)/src/vdbe.h \ parse.h # Header files used by the VDBE submodule # VDBEHDR = \ $(HDR) \ $(TOP)/src/vdbeInt.h # 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.la sqlite@TARGET_EXEEXT@ Makefile: $(TOP)/Makefile.in ./config.status # Generate the file "last_change" which contains the date of change # of the most recently modified source code file # last_change: $(SRC) cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \ | awk '{print $$5,$$6}' >last_change libsqlite.la: $(LIBOBJ) $(LTLINK) -o libsqlite.la $(LIBOBJ) ${RELEASE} -rpath @exec_prefix@/lib \ -version-info "8:6:8" libtclsqlite.la: tclsqlite.lo libsqlite.la $(LTLINK) -o libtclsqlite.la tclsqlite.lo \ libsqlite.la $(LIBTCL) -rpath @exec_prefix@/lib/sqlite \ -version-info "8:6:8" sqlite@TARGET_EXEEXT@: $(TOP)/src/shell.c libsqlite.la sqlite.h $(LTLINK) $(READLINE_FLAGS) -o sqlite $(TOP)/src/shell.c \ libsqlite.la $(LIBREADLINE) # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # target_source: $(SRC) $(VDBEHDR) rm -rf tsrc mkdir tsrc cp $(SRC) $(VDBEHDR) tsrc rm tsrc/sqlite.h.in tsrc/parse.y cp parse.c opcodes.c tsrc # Rules to build the LEMON compiler generator # lemon@BUILD_EXEEXT@: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c $(BCC) -o lemon $(TOP)/tool/lemon.c cp $(TOP)/tool/lempar.c . btree.lo: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h $(LTCOMPILE) -c $(TOP)/src/btree.c btree_rb.lo: $(TOP)/src/btree_rb.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/btree_rb.c build.lo: $(TOP)/src/build.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/build.c main.lo: $(TOP)/src/main.c $(HDR) $(LTCOMPILE) -c ${INCOREFLAGS} $(TOP)/src/main.c pager.lo: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h $(LTCOMPILE) -c $(TOP)/src/pager.c opcodes.lo: opcodes.c $(LTCOMPILE) -c opcodes.c opcodes.c: $(TOP)/src/vdbe.c echo '/* Automatically generated file. Do not edit */' >opcodes.c echo 'char *sqliteOpcodeNames[] = { "???", ' >>opcodes.c grep '^case OP_' $(TOP)/src/vdbe.c | \ sed -e 's/^.*OP_/ "/' -e 's/:.*$$/", /' >>opcodes.c echo '};' >>opcodes.c opcodes.h: $(TOP)/src/vdbe.h echo '/* Automatically generated file. Do not edit */' >opcodes.h grep '^case OP_' $(TOP)/src/vdbe.c | \ sed -e 's/://' | \ awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h os.lo: $(TOP)/src/os.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/os.c parse.lo: parse.c $(HDR) $(LTCOMPILE) -c parse.c parse.h: parse.c parse.c: $(TOP)/src/parse.y lemon@BUILD_EXEEXT@ 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",sizeof(char*));' >>temp.c echo 'exit(0);}' >>temp.c $(BCC) -o temp temp.c ./temp >config.h echo >>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)/ \ $(TOP)/src/sqlite.h.in >sqlite.h tokenize.lo: $(TOP)/src/tokenize.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/tokenize.c util.lo: $(TOP)/src/util.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/util.c vdbe.lo: $(TOP)/src/vdbe.c $(VDBEHDR) $(LTCOMPILE) -c $(TOP)/src/vdbe.c vdbeaux.lo: $(TOP)/src/vdbe.c $(VDBEHDR) $(LTCOMPILE) -c $(TOP)/src/vdbeaux.c where.lo: $(TOP)/src/where.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/where.c copy.lo: $(TOP)/src/copy.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/copy.c date.lo: $(TOP)/src/date.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/date.c delete.lo: $(TOP)/src/delete.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/delete.c encode.lo: $(TOP)/src/encode.c $(LTCOMPILE) -c $(TOP)/src/encode.c expr.lo: $(TOP)/src/expr.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/expr.c func.lo: $(TOP)/src/func.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/func.c hash.lo: $(TOP)/src/hash.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/hash.c insert.lo: $(TOP)/src/insert.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/insert.c random.lo: $(TOP)/src/random.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/random.c select.lo: $(TOP)/src/select.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/select.c table.lo: $(TOP)/src/table.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/table.c trigger.lo: $(TOP)/src/trigger.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/trigger.c update.lo: $(TOP)/src/update.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/update.c vacuum.lo: $(TOP)/src/vacuum.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/vacuum.c tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c pragma.lo: $(TOP)/src/pragma.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/pragma.c printf.lo: $(TOP)/src/printf.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/printf.c attach.lo: $(TOP)/src/attach.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/attach.c auth.lo: $(TOP)/src/auth.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/auth.c tclsqlite-sh.lo: $(TOP)/src/tclsqlite.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -DTCLSH=1 -o $@ -c $(TOP)/src/tclsqlite.c tclsqlite: tclsqlite-sh.lo libsqlite.la $(LTLINK) $(TCL_FLAGS) -o tclsqlite tclsqlite-sh.lo libsqlite.la $(LIBTCL) testfixture@TARGET_EXEEXT@: $(TOP)/src/tclsqlite.c libtclsqlite.la libsqlite.la $(TESTSRC) $(LTLINK) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1\ -o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \ libtclsqlite.la libsqlite.la $(LIBTCL) fulltest: testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@ ./testfixture $(TOP)/test/all.test test: testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@ ./testfixture $(TOP)/test/quick.test index.html: $(TOP)/www/index.tcl last_change tclsh $(TOP)/www/index.tcl `cat $(TOP)/VERSION` >index.html sqlite.html: $(TOP)/www/sqlite.tcl tclsh $(TOP)/www/sqlite.tcl >sqlite.html c_interface.html: $(TOP)/www/c_interface.tcl tclsh $(TOP)/www/c_interface.tcl >c_interface.html changes.html: $(TOP)/www/changes.tcl tclsh $(TOP)/www/changes.tcl >changes.html lang.html: $(TOP)/www/lang.tcl tclsh $(TOP)/www/lang.tcl >lang.html vdbe.html: $(TOP)/www/vdbe.tcl tclsh $(TOP)/www/vdbe.tcl >vdbe.html arch.html: $(TOP)/www/arch.tcl tclsh $(TOP)/www/arch.tcl >arch.html arch.png: $(TOP)/www/arch.png cp $(TOP)/www/arch.png . opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html mingw.html: $(TOP)/www/mingw.tcl tclsh $(TOP)/www/mingw.tcl >mingw.html tclsqlite.html: $(TOP)/www/tclsqlite.tcl tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html speed.html: $(TOP)/www/speed.tcl tclsh $(TOP)/www/speed.tcl >speed.html faq.html: $(TOP)/www/faq.tcl tclsh $(TOP)/www/faq.tcl >faq.html formatchng.html: $(TOP)/www/formatchng.tcl tclsh $(TOP)/www/formatchng.tcl >formatchng.html conflict.html: $(TOP)/www/conflict.tcl tclsh $(TOP)/www/conflict.tcl >conflict.html download.html: $(TOP)/www/download.tcl tclsh $(TOP)/www/download.tcl >download.html omitted.html: $(TOP)/www/omitted.tcl tclsh $(TOP)/www/omitted.tcl >omitted.html datatypes.html: $(TOP)/www/datatypes.tcl tclsh $(TOP)/www/datatypes.tcl >datatypes.html quickstart.html: $(TOP)/www/quickstart.tcl tclsh $(TOP)/www/quickstart.tcl >quickstart.html fileformat.html: $(TOP)/www/fileformat.tcl tclsh $(TOP)/www/fileformat.tcl >fileformat.html nulls.html: $(TOP)/www/nulls.tcl tclsh $(TOP)/www/nulls.tcl >nulls.html # Files to be published on the website. # DOC = \ index.html \ sqlite.html \ changes.html \ lang.html \ opcode.html \ arch.html \ arch.png \ vdbe.html \ c_interface.html \ mingw.html \ tclsqlite.html \ download.html \ speed.html \ faq.html \ formatchng.html \ conflict.html \ omitted.html \ datatypes.html \ quickstart.html \ fileformat.html \ nulls.html doc: $(DOC) mkdir -p doc mv $(DOC) doc install: sqlite libsqlite.la sqlite.h $(INSTALL) -d $(DESTDIR)$(exec_prefix)/lib $(LTINSTALL) libsqlite.la $(DESTDIR)$(exec_prefix)/lib $(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin $(LTINSTALL) sqlite $(DESTDIR)$(exec_prefix)/bin $(INSTALL) -d $(DESTDIR)$(prefix)/include $(INSTALL) -m 0644 sqlite.h $(DESTDIR)$(prefix)/include $(INSTALL) -d $(DESTDIR)$(exec_prefix)/lib/pkgconfig; $(INSTALL) -m 0644 sqlite.pc $(DESTDIR)$(exec_prefix)/lib/pkgconfig; clean: rm -f *.lo *.la *.o sqlite@TARGET_EXEEXT@ libsqlite.la sqlite.h opcodes.* rm -rf .libs .deps rm -f lemon@BUILD_EXEEXT@ lempar.c parse.* sqlite*.tar.gz rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out rm -f testfixture@TARGET_EXEEXT@ test.db rm -rf doc rm -f sqlite.dll sqlite.lib # # Windows section; all this funky .dll stuff ;-) # dll: sqlite.dll REAL_LIBOBJ = $(LIBOBJ:%.lo=.libs/%.o) sqlite.dll: $(LIBOBJ) $(TOP)/sqlite.def dllwrap --dllname sqlite.dll --def $(TOP)/sqlite.def $(REAL_LIBOBJ) strip sqlite.dll #target for dll import libraries implib: sqlite.lib #make Borland C++ and/or Microsoft VC import library for the dll # ignore any errors (usually due to missing programs) sqlite.lib: sqlite.dll -implib -a sqlite.lib sqlite.dll -lib /machine:i386 /def:$(TOP)/sqlite.def distclean: clean rm -f config.log config.status libtool Makefile config.h sqlite-2.8.17/sqlite.pc.in0000644000175000001440000000035510232547613015306 0ustar drhusers00000000000000# Package Information for pkg-config prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: SQLite Description: SQL database engine Version: @VERSION@ Libs: -L${libdir} -lsqlite Cflags: -I${includedir} sqlite-2.8.17/VERSION0000644000175000001440000000000710351570006014110 0ustar drhusers000000000000002.8.17 sqlite-2.8.17/Makefile.linux-gcc0000644000175000001440000000655510232547613016414 0ustar drhusers00000000000000#!/usr/make # # Makefile for SQLITE # # This is a template makefile for SQLite. Most people prefer to # use the autoconf generated "configure" script to generate the # makefile automatically. But that does not work for everybody # and in every situation. If you are having problems with the # "configure" script, you might want to try this makefile as an # alternative. Create a copy of this file, edit the parameters # below and type "make". # #### The toplevel directory of the source tree. This is the directory # that contains this "Makefile.in" and the "configure.in" script. # TOP = ../sqlite #### C Compiler and options for use in building executables that # will run on the platform that is doing the build. # BCC = gcc -g -O2 #BCC = /opt/ancic/bin/c89 -0 #### If the target operating system supports the "usleep()" system # call, then define the HAVE_USLEEP macro for all C modules. # #USLEEP = USLEEP = -DHAVE_USLEEP=1 #### If you want the SQLite library to be safe for use within a # multi-threaded program, then define the following macro # appropriately: # #THREADSAFE = -DTHREADSAFE=1 THREADSAFE = -DTHREADSAFE=0 #### Specify any extra linker options needed to make the library # thread safe # #THREADLIB = -lpthread THREADLIB = #### Leave MEMORY_DEBUG undefined for maximum speed. Use MEMORY_DEBUG=1 # to check for memory leaks. Use MEMORY_DEBUG=2 to print a log of all # malloc()s and free()s in order to track down memory leaks. # # SQLite uses some expensive assert() statements in the inner loop. # You can make the library go almost twice as fast if you compile # with -DNDEBUG=1 # #OPTS = -DMEMORY_DEBUG=2 #OPTS = -DMEMORY_DEBUG=1 #OPTS = OPTS = -DNDEBUG=1 #### The suffix to add to executable files. ".exe" for windows. # Nothing for unix. # #EXE = .exe EXE = #### C Compile and options for use in building executables that # will run on the target platform. This is usually the same # as BCC, unless you are cross-compiling. # TCC = gcc -O6 #TCC = gcc -g -O0 -Wall #TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage #TCC = /opt/mingw/bin/i386-mingw32-gcc -O6 #TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive #### Tools used to build a static library. # AR = ar cr #AR = /opt/mingw/bin/i386-mingw32-ar cr RANLIB = ranlib #RANLIB = /opt/mingw/bin/i386-mingw32-ranlib #### Extra compiler options needed for programs that use the TCL library. # #TCL_FLAGS = #TCL_FLAGS = -DSTATIC_BUILD=1 TCL_FLAGS = -I/home/drh/tcltk/8.4linux #TCL_FLAGS = -I/home/drh/tcltk/8.4win -DSTATIC_BUILD=1 #TCL_FLAGS = -I/home/drh/tcltk/8.3hpux #### Linker options needed to link against the TCL library. # #LIBTCL = -ltcl -lm -ldl LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl #LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt #LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc #### Compiler options needed for programs that use the readline() library. # #READLINE_FLAGS = READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline #### Linker options needed by programs using readline() must link against. # #LIBREADLINE = LIBREADLINE = -static -lreadline -ltermcap #### Should the database engine assume text is coded as UTF-8 or iso8859? # # ENCODING = UTF8 ENCODING = ISO8859 # You should not have to change anything below this line ############################################################################### include $(TOP)/main.mk sqlite-2.8.17/publish.sh0000644000175000001440000001131310232547613015052 0ustar drhusers00000000000000#!/bin/sh # # This script is used to compile SQLite and all its documentation and # ship everything up to the SQLite website. This script will only work # on the system "zadok" at the Hwaci offices. But others might find # the script useful as an example. # # Set srcdir to the name of the directory that contains the publish.sh # script. # srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'` # Clear out the build directory "doc" # #rm -rf doc #make doc # Get the current version number - needed to help build filenames # VERS=`cat $srcdir/VERSION` VERSW=`sed 's/\./_/g' $srcdir/VERSION` # Start by building an sqlite shell for linux. # make clean make sqlite strip sqlite mv sqlite sqlite-$VERS.bin rm -f sqlite.bin.gz gzip sqlite-$VERS.bin mv sqlite-$VERS.bin.gz doc # Build the tclsqlite.so shared library for import into tclsh or wish # under Linux # make target_source rm -f doc/sqlite-source-$VERSW.zip cd tsrc zip ../doc/sqlite-source-$VERSW.zip * rm shell.c TCLDIR=/home/drh/tcltk/8.2linux TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1' gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so strip tclsqlite.so mv tclsqlite.so tclsqlite-$VERS.so gzip tclsqlite-$VERS.so mv tclsqlite-$VERS.so.gz ../doc rm tclsqlite.c gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so strip sqlite.so mv sqlite.so sqlite-$VERS.so gzip sqlite-$VERS.so mv sqlite-$VERS.so.gz ../doc cd .. # Build the tclsqlite.dll shared library that can be imported into tclsh # or wish on windows. # make target_source cd tsrc rm shell.c TCLDIR=/home/drh/tcltk/8.2win TCLSTUBLIB=$TCLDIR/tclstub82.a PATH=$PATH:/opt/mingw/bin OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1' CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR" rm shell.c for i in *.c; do CMD="$CC -c $i" echo $CMD $CMD done echo 'EXPORTS' >tclsqlite.def echo 'Tclsqlite_Init' >>tclsqlite.def echo 'Sqlite_Init' >>tclsqlite.def i386-mingw32msvc-dllwrap \ --def tclsqlite.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ --target i386-mingw32 \ -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB i386-mingw32msvc-strip tclsqlite.dll #mv tclsqlite.dll ../tclsqlite-$VERSW.dll rm tclsqlite.o cat >sqlite.def <<\END_OF_FILE EXPORTS sqlite_open sqlite_close sqlite_exec sqlite_last_insert_rowid sqlite_error_string sqlite_interrupt sqlite_complete sqlite_busy_handler sqlite_busy_timeout sqlite_get_table sqlite_free_table sqlite_mprintf sqlite_vmprintf sqlite_exec_printf sqlite_exec_vprintf sqlite_get_table_printf sqlite_get_table_vprintf sqlite_freemem sqlite_libversion sqlite_libencoding sqlite_changes sqlite_create_function sqlite_create_aggregate sqlite_function_type sqlite_user_data sqlite_aggregate_context sqlite_aggregate_count sqlite_set_result_string sqlite_set_result_int sqlite_set_result_double sqlite_set_result_error sqliteMalloc sqliteFree sqliteRealloc sqlite_set_authorizer sqlite_trace sqlite_compile sqlite_step sqlite_finalize sqlite_reset sqlite_bind sqlite_last_statement_changes sqlite_encode_binary sqlite_decode_binary END_OF_FILE i386-mingw32msvc-dllwrap \ --def sqlite.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ --target i386-mingw32 \ -dllname sqlite.dll -lmsvcrt *.o i386-mingw32msvc-strip sqlite.dll zip ../doc/tclsqlite-$VERSW.zip tclsqlite.dll zip ../doc/sqlitedll-$VERSW.zip sqlite.dll sqlite.def cd .. # Build the sqlite.exe executable for windows. # make target_source cd tsrc rm tclsqlite.c OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe zip ../doc/sqlite-$VERSW.zip sqlite.exe cd .. # Construct a tarball of the source tree # ORIGIN=`pwd` cd $srcdir cd .. mv sqlite_v2 sqlite-$VERS EXCLUDE=`find sqlite-$VERS -print | grep CVS | sed 's,^, --exclude ,'` tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS mv sqlite-$VERS sqlite_v2 cd $ORIGIN # # Build RPMS (binary) and Source RPM # # Make sure we are properly setup to build RPMs # echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros mkdir $HOME/rpm mkdir $HOME/rpm/BUILD mkdir $HOME/rpm/SOURCES mkdir $HOME/rpm/RPMS mkdir $HOME/rpm/SRPMS mkdir $HOME/rpm/SPECS # create the spec file from the template sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec # copy the source tarball to the rpm directory cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/. # build all the rpms rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log # copy the RPMs into the build directory. mv $HOME/rpm/RPMS/i386/sqlite*-$VERS*.rpm doc mv $HOME/rpm/SRPMS/sqlite-$VERS*.rpm doc
    %s %s %s %s\n", $3, $4, $5, $6 }else if( $1=="*/" ){ printf "