Thread: [pure-lang-svn] SF.net SVN: pure-lang: [137] pure/trunk (Page 3)
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-05-26 20:25:27
|
Revision: 137 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=137&view=rev Author: agraef Date: 2008-05-26 13:25:34 -0700 (Mon, 26 May 2008) Log Message: ----------- Environment vectors are now maintained on the shadow stack, so that all local functions and anonymous closures are now eligible for tail call optimization. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/TODO pure/trunk/funcall.h pure/trunk/interpreter.cc pure/trunk/interpreter.hh pure/trunk/pure.1 pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/ChangeLog 2008-05-26 20:25:34 UTC (rev 137) @@ -1,3 +1,11 @@ +2008-05-26 Albert Graef <Dr....@t-...> + + * interpreter.cc, runtime.cc: Overhaul of the shadow stack + machinery. Environment vectors are now maintained on the shadow + stack, so that all local functions and anonymous closures are + eligible for tail call optimization, even if they need access to + their environment. + 2008-05-25 Albert Graef <Dr....@t-...> * lib/prelude.pure: Rewrite prelude operations to make them Modified: pure/trunk/TODO =================================================================== --- pure/trunk/TODO 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/TODO 2008-05-26 20:25:34 UTC (rev 137) @@ -36,8 +36,7 @@ functions to the runtime. - Better support for proper tail calls. Currently this only works for direct - calls and if the callee doesn't need an environment (i.e., all data is - passed as parameters). See the manpage for details. + calls. See the manpage for details. - More aggressive optimizations (common subexpression elimination for "pure" a.k.a. side-effect-free function calls, etc.). Modified: pure/trunk/funcall.h =================================================================== --- pure/trunk/funcall.h 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/funcall.h 2008-05-26 20:25:34 UTC (rev 137) @@ -81,3 +81,77 @@ assert(n <= MAXARGS && "funcall: function call exceeds maximum #args"); \ ret = 0; break; \ } + +/* Same as above, but with an extra environment parameter. */ + +#define xfuncall(ret,fp,n,e,x) \ + switch (n) { \ + case 0: ret = ((pure_expr*(*)(uint32_t))fp)(e); break; \ + case 1: ret = ((pure_expr*(*)(uint32_t,void*))fp)(e,x[0]); break; \ + case 2: ret = ((pure_expr*(*)(uint32_t,void*,void*))fp)(e,x[0],x[1]); break; \ + case 3: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*))fp)(e,x[0],x[1],x[2]); break; \ + case 4: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3]); break; \ + case 5: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4]); break; \ + case 6: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5]); break; \ + case 7: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6]); break; \ + case 8: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]); break; \ + case 9: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8]); break; \ + case 10: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9]); break; \ + case 11: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10]); break; \ + case 12: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11]); break; \ + case 13: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12]); break; \ + case 14: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13]); break; \ + case 15: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14]); break; \ + case 16: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]); break; \ + case 17: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16]); break; \ + case 18: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17]); break; \ + case 19: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18]); break; \ + case 20: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19]); break; \ + case 21: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20]); break; \ + case 22: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21]); break; \ + case 23: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22]); break; \ + case 24: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23]); break; \ + case 25: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24]); break; \ + case 26: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25]); break; \ + case 27: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26]); break; \ + case 28: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27]); break; \ + case 29: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28]); break; \ + case 30: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29]); break; \ + case 31: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30]); break; \ + case 32: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31]); break; \ + case 33: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32]); break; \ + case 34: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33]); break; \ + case 35: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34]); break; \ + case 36: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35]); break; \ + case 37: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36]); break; \ + case 38: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37]); break; \ + case 39: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38]); break; \ + case 40: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39]); break; \ + case 41: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40]); break; \ + case 42: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41]); break; \ + case 43: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42]); break; \ + case 44: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43]); break; \ + case 45: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44]); break; \ + case 46: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45]); break; \ + case 47: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46]); break; \ + case 48: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47]); break; \ + case 49: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48]); break; \ + case 50: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49]); break; \ + case 51: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50]); break; \ + case 52: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51]); break; \ + case 53: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52]); break; \ + case 54: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53]); break; \ + case 55: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54]); break; \ + case 56: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55]); break; \ + case 57: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56]); break; \ + case 58: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57]); break; \ + case 59: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58]); break; \ + case 60: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59]); break; \ + case 61: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60]); break; \ + case 62: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60],x[61]); break; \ + case 63: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60],x[61],x[62]); break; \ + case 64: ret = ((pure_expr*(*)(uint32_t,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*,void*))fp)(e,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60],x[61],x[62],x[63]); break; \ + default: \ + assert(n <= MAXARGS && "funcall: function call exceeds maximum #args"); \ + ret = 0; break; \ +} Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/interpreter.cc 2008-05-26 20:25:34 UTC (rev 137) @@ -55,7 +55,7 @@ stats(false), temp(0), ps("> "), lib(""), histfile("/.pure_history"), modname("pure"), nerrs(0), source_s(0), result(0), mem(0), exps(0), tmps(0), - module(0), JIT(0), FPM(0), fptr(0), vptr(0) + module(0), JIT(0), FPM(0), fptr(0) { if (!g_interp) { g_interp = this; @@ -64,6 +64,7 @@ sstk_sz = 0; sstk_cap = 0x10000; // 64K sstk = (pure_expr**)malloc(sstk_cap*sizeof(pure_expr*)); + assert(sstk); // Initialize the JIT. @@ -187,6 +188,14 @@ StrExprPtrTy = PointerType::get(StrExprTy, 0); PtrExprPtrTy = PointerType::get(PtrExprTy, 0); + sstkvar = new GlobalVariable + (ExprPtrPtrTy, false, GlobalVariable::InternalLinkage, 0, "$$sstk$$", + module); + JIT->addGlobalMapping(sstkvar, &sstk); + fptrvar = new GlobalVariable + (VoidPtrTy, false, GlobalVariable::InternalLinkage, 0, "$$fptr$$", module); + JIT->addGlobalMapping(fptrvar, &fptr); + // Add prototypes for the runtime interface and enter the corresponding // function pointers into the runtime map. @@ -207,9 +216,9 @@ declare_extern((void*)pure_double, "pure_double", "expr*", 1, "double"); declare_extern((void*)pure_string_dup, - "pure_string_dup", "expr*", 1, "char*"); + "pure_string_dup", "expr*", 1, "char*"); declare_extern((void*)pure_cstring_dup, - "pure_cstring_dup", "expr*", 1, "char*"); + "pure_cstring_dup","expr*", 1, "char*"); declare_extern((void*)pure_pointer, "pure_pointer", "expr*", 1, "void*"); declare_extern((void*)pure_apply, @@ -221,13 +230,13 @@ "pure_cmp_string", "int", 2, "expr*", "char*"); declare_extern((void*)pure_get_cstring, - "pure_get_cstring", "char*", 1, "expr*"); + "pure_get_cstring", "char*", 1, "expr*"); declare_extern((void*)pure_free_cstrings, - "pure_free_cstrings", "void", 0); + "pure_free_cstrings","void", 0); declare_extern((void*)pure_get_bigint, - "pure_get_bigint", "void*", 1, "expr*"); + "pure_get_bigint", "void*", 1, "expr*"); declare_extern((void*)pure_get_long, - "pure_get_long", "long", 1, "expr*"); + "pure_get_long", "long", 1, "expr*"); declare_extern((void*)pure_catch, "pure_catch", "expr*", 2, "expr*", "expr*"); @@ -251,18 +260,18 @@ "pure_free_args", "void", -2, "expr*", "int"); declare_extern((void*)pure_push_args, - "pure_push_args", "void", -1, "int"); + "pure_push_args", "int", -2, "int", "int"); declare_extern((void*)pure_pop_args, - "pure_pop_args", "void", -2, "expr*", "int"); + "pure_pop_args", "void", 3, "expr*", "int", "int"); declare_extern((void*)pure_pop_tail_args, - "pure_pop_tail_args", "void", -2, "expr*", "int"); + "pure_pop_tail_args","void", 3, "expr*", "int", "int"); declare_extern((void*)pure_push_arg, "pure_push_arg", "void", 1, "expr*"); declare_extern((void*)pure_pop_arg, - "pure_pop_arg", "void", 1, "expr*"); + "pure_pop_arg", "void", 0); declare_extern((void*)pure_pop_tail_arg, - "pure_pop_tail_arg", "void", 1, "expr*"); + "pure_pop_tail_arg", "void", 0); declare_extern((void*)pure_debug, "pure_debug", "void", -2, "int", "char*"); @@ -1588,7 +1597,7 @@ } else { // uninitialized environment; simply copy everything tag = e.tag; name = e.name; n = e.n; f = e.f; h = e.h; fp = e.fp; - args = e.args; envs = e.envs; argv = e.argv; + args = e.args; envs = e.envs; b = e.b; local = e.local; parent = e.parent; } fmap = e.fmap; fmap_idx = e.fmap_idx; @@ -1628,7 +1637,7 @@ fp = 0; // delete all nested environments and reinitialize other body-related data fmap.clear(); fmap_idx = 0; - xmap.clear(); xtab.clear(); prop.clear(); m = 0; argv = 0; + xmap.clear(); xtab.clear(); prop.clear(); m = 0; // now that all references have been removed, delete the function pointers for (list<Function*>::iterator fi = to_be_deleted.begin(); fi != to_be_deleted.end(); fi++) { @@ -1693,11 +1702,19 @@ if (isa<CallInst>(it)) { CallInst* c1 = cast<CallInst>(it); if (c1->getCalledFunction() == - interp.module->getFunction("pure_push_args") || - c1->getCalledFunction() == interp.module->getFunction("pure_push_arg")) { free_fun = interp.module->getFunction("pure_pop_tail_args"); free1_fun = interp.module->getFunction("pure_pop_tail_arg"); + } else if (c1->getCalledFunction() == + interp.module->getFunction("pure_push_args")) { + free_fun = interp.module->getFunction("pure_pop_tail_args"); + free1_fun = interp.module->getFunction("pure_pop_tail_arg"); + /* Patch up this call to correct the offset of the environment. */ + CallInst *c2 = c1->clone(); + c1->getParent()->getInstList().insert(c1, c2); + Value *v = BinaryOperator::createSub(c2, UInt(n+m+1), "", c1); + BasicBlock::iterator ii(c1); + ReplaceInstWithValue(c1->getParent()->getInstList(), ii, v); } } } @@ -1705,24 +1722,16 @@ } // We must garbage-collect args and environment here, immediately before the // call (if any), or the return instruction otherwise. - vector<Value*> myargs; if (pi != ret && n == 1 && m == 0) - new CallInst(free1_fun, args[0], "", pi); - else if (pi != ret && n == 0 && m == 1) { - Value *v = new GetElementPtrInst(envs, Zero, "", pi); - new CallInst(free1_fun, new LoadInst(v, "", pi), "", pi); - } else if (n+m != 0) { + new CallInst(free1_fun, "", pi); + else if (n+m != 0) { + vector<Value*> myargs; if (pi == ret) myargs.push_back(v); else myargs.push_back(ConstantPointerNull::get(interp.ExprPtrTy)); - myargs.push_back(UInt(n+m)); - for (size_t i = 0; i < n; i++) - myargs.push_back(args[i]); - for (size_t i = 0; i < m; i++) { - Value *v = new GetElementPtrInst(envs, UInt(i), "", pi); - myargs.push_back(new LoadInst(v, "", pi)); - } + myargs.push_back(UInt(n)); + myargs.push_back(UInt(m)); new CallInst(free_fun, myargs.begin(), myargs.end(), "", pi); if (pi == ret) { Value *x[1] = { v }; @@ -2549,11 +2558,10 @@ // free arguments (we do that here so that the arguments don't get freed // before we know that we don't need them anymore) if (n > 0) { - vector<Value*> freeargs(n+2); + vector<Value*> freeargs(3); freeargs[0] = u; freeargs[1] = UInt(n); - for (size_t i = 0; i < n; i++) - freeargs[i+2] = args[i]; + freeargs[2] = Zero; b.CreateCall(module->getFunction("pure_pop_args"), freeargs.begin(), freeargs.end()); b.CreateCall(module->getFunction("pure_unref"), u); @@ -2597,11 +2605,10 @@ Value *interpreter::envptr(Env *f) { - if (!fptr) return NullPtr; - if (!vptr) vptr = new GlobalVariable - (VoidPtrTy, false, GlobalVariable::InternalLinkage, 0, "$$fptr$$", module); - JIT->updateGlobalMapping(vptr, &fptr); - return act_builder().CreateLoad(vptr); + if (!fptr) + return NullPtr; + else + return act_builder().CreateLoad(fptrvar); } pure_expr *interpreter::doeval(expr x, pure_expr*& e) @@ -3126,6 +3133,7 @@ else { vector<Value*> argv1; argv1.push_back(UInt(n)); + argv1.push_back(Zero); argv1.insert(argv1.end(), argv.begin(), argv.end()); act_env().CreateCall(module->getFunction("pure_push_args"), argv1); } @@ -3624,7 +3632,8 @@ { // environment proxy Env &e = act_env(); - return e.CreateLoadGEP(e.envs, UInt(v)); + Value *sstkptr = e.builder.CreateLoad(sstkvar); + return e.CreateLoadGEP(sstkptr, e.builder.CreateAdd(e.envs, UInt(v))); } Value *interpreter::vref(int32_t tag, uint8_t idx, path p) @@ -3694,28 +3703,22 @@ // direct call of a function, with parameters assert(f.f); size_t n = args.size(), m = env.size(); - // initialize the environment parameter + // count references to parameters and create the environment parameter assert(f.local || m == 0); - for (size_t i = 0; i < m; i++) - e.builder.CreateStore(env[i], e.CreateGEP(e.argv, UInt(i))); - // pass the environment as the first parameter, if applicable - vector<Value*> x; - if (f.local && m > 0) { - if (m > e.l) e.l = m; - x.push_back(e.argv); - } - // count references to parameters + Value *argv = 0; if (n == 1 && m == 0) e.CreateCall(module->getFunction("pure_push_arg"), args); - else if (n == 0 && m == 1) - e.CreateCall(module->getFunction("pure_push_arg"), env); else if (n+m > 0) { vector<Value*> args1; - args1.push_back(UInt(n+m)); + args1.push_back(UInt(n)); + args1.push_back(UInt(m)); args1.insert(args1.end(), args.begin(), args.end()); args1.insert(args1.end(), env.begin(), env.end()); - e.CreateCall(module->getFunction("pure_push_args"), args1); + argv = e.CreateCall(module->getFunction("pure_push_args"), args1); } + // pass the environment as the first parameter, if applicable + vector<Value*> x; + if (m>0) x.push_back(argv); // pass the function parameters x.insert(x.end(), args.begin(), args.end()); // create the call @@ -3989,7 +3992,7 @@ // argument types vector<const Type*> argt(f.n, ExprPtrTy); assert(f.m == 0 || f.local); - if (f.m > 0) argt.insert(argt.begin(), ExprPtrPtrTy); + if (f.m > 0) argt.insert(argt.begin(), Type::Int32Ty); // function type FunctionType *ft = FunctionType::get(ExprPtrTy, argt, false); /* Mangle local function names so that they're easier to identify; as a @@ -4025,14 +4028,7 @@ f.tag == 0 || symtab.sym(f.tag).prec < 10) scope = Function::InternalLinkage; #if USE_FASTCC - /* Currently we only allow fastcc (and thus tail call elimination) if the - function takes no environment. This is because the passed environment - is allocated on the caller's stack, so we can't do a tail call in this - case. It would be possible to also optimize the case of a local - function with environment which just calls itself directly (passing - through the environment), but currently we don't keep track of such - situations and thus this optimization isn't implemented yet. */ - if (!name.empty() && f.m == 0) cc = CallingConv::Fast; + if (!name.empty()) cc = CallingConv::Fast; #endif /* Mangle the name of the C-callable wrapper if it would shadow another C function. */ @@ -4094,10 +4090,6 @@ msg << "entry " << f.name; debug(msg.str().c_str()); } #endif - // Allocate an array to be filled with environment values passed in - // parameterless function calls. NOTE: This needs to be patched up when - // finalizing the function body, as we don't know the needed size yet. - f.argv = f.builder.CreateAlloca(ExprPtrTy, /*UInt(f.l)*/0, "argv"); // return the function just created return f.f; } @@ -4141,8 +4133,9 @@ // failed match is non-fatal, instead we return a "thunk" (literal fbox) // of ourself applied to our arguments as the result vector<Value*> x(f.m); + Value *sstkptr = f.builder.CreateLoad(sstkvar); for (size_t i = 0; i < f.m; i++) { - x[i] = f.CreateLoadGEP(f.envs, UInt(i)); + x[i] = f.CreateLoadGEP(sstkptr, f.builder.CreateAdd(f.envs, UInt(i))); assert(x[i]->getType() == ExprPtrTy); } if (f.m == 1) @@ -4169,16 +4162,6 @@ { Env& f = act_env(); assert(f.f!=0); - // Now that all locals have been processed, we need to patch up the alloca - // for the environment vector used as temporary storage in parameterless - // function calls. - BasicBlock::iterator ii(f.argv); - if (f.l == 0) - ReplaceInstWithValue(f.argv->getParent()->getInstList(), ii, - NullExprPtrPtr); - else - ReplaceInstWithInst(f.argv->getParent()->getInstList(), ii, - new AllocaInst(ExprPtrTy, UInt(f.l), "argv")); // validate the generated code, checking for consistency verifyFunction(*f.f); // optimize Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/interpreter.hh 2008-05-26 20:25:34 UTC (rev 137) @@ -92,9 +92,8 @@ // function environment int32_t tag; // function id, zero for anonymous functions string name; // LLVM assembly function name - // n = #function args, m = #extra args (captured environment), l = max - // environment size in fbox call - uint32_t n, m, l; + // n = #function args, m = #extra args (captured environment) + uint32_t n, m; // f = the (internal) LLVM function, h = the C-callable stub (if needed) llvm::Function *f, *h; // fp = pointer to the JITed function (executable code) @@ -103,8 +102,6 @@ vector<llvm::Value*> args; // environment pointer (expr**) llvm::Value *envs; - // storage for passed environment vectors - llvm::AllocaInst* argv; // mapping of captured variables to the corresponding locals map<xmap_key,uint32_t > xmap; // info about captured variables @@ -164,12 +161,12 @@ llvm::ReturnInst *CreateRet(llvm::Value *v); // default constructor Env() - : tag(0), n(0), m(0), l(0), f(0), h(0), fp(0), args(0), envs(0), argv(0), + : tag(0), n(0), m(0), f(0), h(0), fp(0), args(0), envs(0), fmap(1), fmap_idx(0), b(false), local(false), parent(0), refc(0) {} // environment for an anonymous closure with given body x Env(int32_t _tag, uint32_t _n, expr x, bool _b, bool _local = false) - : tag(_tag), n(_n), m(0), l(0), f(0), h(0), fp(0), args(n), envs(0), - argv(0), fmap(1), fmap_idx(0), b(_b), local(_local), parent(0), refc(0) + : tag(_tag), n(_n), m(0), f(0), h(0), fp(0), args(n), envs(0), + fmap(1), fmap_idx(0), b(_b), local(_local), parent(0), refc(0) { if (envstk.empty()) { assert(!local); @@ -182,8 +179,8 @@ } // environment for a named closure with given definition info Env(int32_t _tag, const env_info& info, bool _b, bool _local = false) - : tag(_tag), n(info.argc), m(0), l(0), f(0), h(0), fp(0), args(n), envs(0), - argv(0), fmap(1), fmap_idx(0), b(_b), local(_local), parent(0), refc(0) + : tag(_tag), n(info.argc), m(0), f(0), h(0), fp(0), args(n), envs(0), + fmap(1), fmap_idx(0), b(_b), local(_local), parent(0), refc(0) { if (envstk.empty()) { assert(!local); @@ -393,6 +390,7 @@ map<int32_t,Env> globalfuns; list<pure_exception> estk; pure_expr** sstk; size_t sstk_cap, sstk_sz; + llvm::GlobalVariable *sstkvar; #if DEBUG set<pure_expr*> mem_allocations; #endif @@ -405,7 +403,7 @@ string asname = ""); private: Env *fptr; - llvm::GlobalVariable *vptr; + llvm::GlobalVariable *fptrvar; llvm::Value *envptr(Env *f); EnvStack envstk; void push(const char *msg, Env *e); Modified: pure/trunk/pure.1 =================================================================== --- pure/trunk/pure.1 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/pure.1 2008-05-26 20:25:34 UTC (rev 137) @@ -1092,33 +1092,23 @@ Fortunately, Pure normally does proper tail calls (if LLVM provides that feature on the platform at hand), so most tail-recursive definitions should work fine in limited stack space. For instance, the following little program -should loop forever if your platform supports the required optimizations: +will loop forever if your platform supports the required optimizations: .sp .nf loop = loop; .fi .PP -The current tail call implementation appears to work fairly well in practice, -but it has a few quirks which are discussed in the following. Most notably, a -tail call will be eliminated \fIonly\fP if the call is done \fIdirectly\fP, -i.e., through an explicit call, not through a (global or local) function -variable. Otherwise the call will be handled by the runtime system which is -written in C and can't do proper tail calls because C can't (at least not in a -portable way). -.PP -This also affects mutually recursive global function calls, since there the -calls are handled in an indirect way, too, through an anonymous global -variable. (This is done so that a global function definition can be changed at -any time during an interactive session, without having to recompile the entire -program.) However, mutual tail recursion does work with \fIlocal\fP functions, -so it's easy to work around this limitation. -.PP -Alas, with local functions there's another restriction, namely that a local -function can be tail-called \fIonly\fP if it does \fInot\fP use its -environment. That's because in the current implementation the implicit -environment parameter is created on the caller's stack. Hence, to get proper -tail recursion with local functions, you \fImust\fP pass all data needed by -the function as parameters (which can usually be achieved quite easily). +In the current implementation, a tail call will be eliminated \fIonly\fP if +the call is done \fIdirectly\fP, i.e., through an explicit call, not through a +(global or local) function variable. Otherwise the call will be handled by the +runtime system which is written in C and can't do proper tail calls because C +can't (at least not in a portable way). This also affects mutually recursive +global function calls, since there the calls are handled in an indirect way, +too, through an anonymous global variable. (This is done so that a global +function definition can be changed at any time during an interactive session, +without having to recompile the entire program.) However, mutual tail +recursion does work with \fIlocal\fP functions, so it's easy to work around +this limitation. .SH FILES .TP .B ~/.pure_history Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-05-25 21:14:08 UTC (rev 136) +++ pure/trunk/runtime.cc 2008-05-26 20:25:34 UTC (rev 137) @@ -65,19 +65,13 @@ #define MEMDEBUG_SUMMARY(ret) #endif -// Debug shadow stack manipulations. SSTK_DEBUG=1 adds special code to verify -// the integrity of the shadow stack, any level >1 also prints pushes and pops -// of stack frames. NOTE: Enabling this code slows down the interpreter, and -// generates *lots* of debugging output for level >1. +// Debug shadow stack manipulations. Prints pushes and pops of stack frames. +// NOTE: Enabling this code generates *lots* of debugging output. #if DEBUG>2 -#define SSTK_DEBUG 2 -#else -#if DEBUG>1 #define SSTK_DEBUG 1 #else #define SSTK_DEBUG 0 #endif -#endif // Expression pointers are allocated in larger chunks for better performance. // NOTE: Only internal fields get initialized by new_expr(), the remaining @@ -555,51 +549,43 @@ assert(x && y && x->refc > 0 && y->refc > 0); // travel down the spine, count arguments pure_expr *f = x, *f0, *ret; - uint32_t n = 0; + uint32_t n = 1; while (f->tag == EXPR::APP) { f = f->data.x[0]; n++; } f0 = f; if (f->tag >= 0 && f->data.clos && !f->data.clos->thunked && - f->data.clos->n == n+1) { + f->data.clos->n == n) { // saturated call; execute it now interpreter& interp = *interpreter::g_interp; void *fp = f->data.clos->fp; - size_t i = 0, m = f->data.clos->m, k = n+1+(m>0?1:0); - assert(k <= MAXARGS && "pure_apply: function call exceeds maximum #args"); - void **argv = (void**)alloca(k*sizeof(void*)); + size_t m = f->data.clos->m; + uint32_t env = 0; + void **argv = (void**)alloca(n*sizeof(void*)); assert(argv && "pure_apply: stack overflow"); + assert(n <= MAXARGS && "pure_apply: function call exceeds maximum #args"); assert(f->data.clos->local || m == 0); - pure_expr **env = 0; - if (f->data.clos->local && m>0) { - // add implicit environment parameter - env = (pure_expr**)alloca(m*sizeof(pure_expr*)); - assert(env && "pure_apply: stack overflow"); - argv[i++] = env; - for (size_t j = 0; j < m; j++) { - assert(f->data.clos->env[j]->refc > 0); - env[j] = f->data.clos->env[j]; env[j]->refc++; - } - } // collect arguments f = x; for (size_t j = 1; f->tag == EXPR::APP; j++, f = f->data.x[0]) { assert(f->data.x[1]->refc > 0); - argv[i+n-j] = f->data.x[1]; f->data.x[1]->refc++; + argv[n-1-j] = f->data.x[1]; f->data.x[1]->refc++; } - i += n; argv[i++] = y; - assert(i == k); + argv[n-1] = y; // make sure that we do not gc the function before calling it f0->refc++; pure_free_internal(x); // construct a stack frame { size_t sz = interp.sstk_sz; - assert(k == n+1+(env?1:0)); - resize_sstk(interp.sstk, interp.sstk_cap, sz, n+m+2); - pure_expr** sstk = interp.sstk; + resize_sstk(interp.sstk, interp.sstk_cap, sz, n+m+1); + pure_expr **sstk = interp.sstk; + if (m>0) env = sz+n+1; sstk[sz++] = 0; - for (size_t j = env?1:0; j < k; j++) + for (size_t j = 0; j < n; j++) sstk[sz++] = (pure_expr*)argv[j]; - if (env) for (size_t j = 0; j < m; j++) - sstk[sz++] = env[j]; + for (size_t j = 0; j < m; j++) { + sstk[sz++] = f0->data.clos->env[j]; + assert(f0->data.clos->env[j]->refc > 0); + f0->data.clos->env[j]->refc++; + } #if SSTK_DEBUG>1 cerr << "++ stack: (sz = " << sz << ")\n"; for (size_t i = 0; i < sz; i++) { @@ -617,7 +603,10 @@ cerr << "pure_apply: calling " << x << " (" << y << ") -> " << fp << endl; #endif checkstk(test); - funcall(ret, fp, k, argv); + if (m>0) + xfuncall(ret, fp, n, env, argv) + else + funcall(ret, fp, n, argv) pure_free_internal(f0); return ret; } else { @@ -657,22 +646,18 @@ #endif assert(h->refc > 0 && x->refc > 0); size_t m = x->data.clos->m; + assert(x->data.clos->local || m == 0); pure_expr **env = 0; - if (x->data.clos->local && m>0) { - // add implicit environment parameter - env = (pure_expr**)alloca(m*sizeof(pure_expr*)); - assert(env && "pure_catch: stack overflow"); - for (size_t i = 0; i < m; i++) { - assert(x->data.clos->env[i]->refc > 0); - env[i] = x->data.clos->env[i]; env[i]->refc++; - } + if (m>0) { // construct a stack frame size_t sz = interp.sstk_sz;; resize_sstk(interp.sstk, interp.sstk_cap, sz, m+1); - pure_expr** sstk = interp.sstk; + pure_expr **sstk = interp.sstk; env = sstk+sz+1; sstk[sz++] = 0; - for (size_t i = 0; i < m; i++) - sstk[sz++] = env[i]; + for (size_t j = 0; j < m; j++) { + sstk[sz++] = x->data.clos->env[j]; + assert(env[j]->refc > 0); env[j]->refc++; + } #if SSTK_DEBUG>1 cerr << "++ stack: (sz = " << sz << ")\n"; for (size_t i = 0; i < sz; i++) { @@ -725,7 +710,7 @@ pure_expr *res; if (env) // pass environment - res = ((pure_expr*(*)(void*))fp)(env); + res = ((pure_expr*(*)(uint32_t))fp)(env-interp.sstk); else // parameterless call res = ((pure_expr*(*)())fp)(); @@ -868,17 +853,17 @@ } extern "C" -void pure_push_args(uint32_t n, ...) +uint32_t pure_push_args(uint32_t n, uint32_t m, ...) { va_list ap; interpreter& interp = *interpreter::g_interp; size_t sz = interp.sstk_sz; - resize_sstk(interp.sstk, interp.sstk_cap, sz, n+1); - pure_expr** sstk = interp.sstk; + resize_sstk(interp.sstk, interp.sstk_cap, sz, n+m+1); + pure_expr **sstk = interp.sstk; uint32_t env = (m>0)?sz+n+1:0; // mark the beginning of this frame sstk[sz++] = 0; - va_start(ap, n); - while (n-- > 0) { + va_start(ap, m); + for (size_t i = 0; i < n+m; i++) { pure_expr *x = va_arg(ap, pure_expr*); sstk[sz++] = x; if (x->refc > 0) @@ -887,7 +872,7 @@ pure_new_internal(x); }; va_end(ap); -#if SSTK_DEBUG>1 +#if SSTK_DEBUG cerr << "++ stack: (sz = " << sz << ")\n"; for (size_t i = 0; i < sz; i++) { pure_expr *x = sstk[i]; @@ -899,33 +884,22 @@ } #endif interp.sstk_sz = sz; + // return a pointer to the environment: + return env; } extern "C" -void pure_pop_args(pure_expr *x, uint32_t n, ...) +void pure_pop_args(pure_expr *x, uint32_t n, uint32_t m) { - va_list ap; interpreter& interp = *interpreter::g_interp; -#if SSTK_DEBUG pure_expr **sstk = interp.sstk; - pure_expr **y = (pure_expr**)alloca(n*sizeof(pure_expr*)); - size_t i, sz = interp.sstk_sz, oldsz = sz; - while (sz > 0 && sstk[--sz]) ; + size_t sz = interp.sstk_sz; +#if !defined(NDEBUG) || SSTK_DEBUG + size_t oldsz = sz; +#endif + sz -= n+m+1; assert(sz < oldsz && !sstk[sz]); - if (x) x->refc++; - va_start(ap, n); - for (i = 0; i < n; i++) { - pure_expr *x = va_arg(ap, pure_expr*); - y[i] = x; - }; - va_end(ap); - if (oldsz-sz-1 != n) goto error; - for (i = 0; i < n; i++) { - pure_expr *x = y[i]; - if (sstk[sz+i+1] != x) goto error; - } - interp.sstk_sz = sz; -#if SSTK_DEBUG>1 +#if SSTK_DEBUG cerr << "++ stack: (oldsz = " << oldsz << ")\n"; for (size_t i = 0; i < oldsz; i++) { pure_expr *x = sstk[i]; @@ -936,74 +910,29 @@ cerr << i << ": " << "** frame **\n"; } #endif - for (size_t i = 0; i < n; i++) { - pure_expr *x = y[i]; - if (x->refc > 1) - x->refc--; - else - pure_free_internal(x); - } - return; - error: - cerr << "ERROR: can't find stack frame to be popped.\n"; - cerr << "++ stack: (oldsz = " << oldsz << ")\n"; - for (size_t i = 0; i < oldsz; i++) { - pure_expr *x = sstk[i]; - if (x) - cerr << i << ": " << (void*)x << ": " << x << endl; - else - cerr << i << ": " << "** frame **\n"; - } - cerr << "++ pop:\n"; - for (size_t i = 0; i < n; i++) { - pure_expr *x = y[i]; - cerr << i << ": " << (void*)x << ": " << x << endl; - } - abort(); -#else - // This doesn't verify the integrity of the shadow stack and is *much* - // faster. - interp.sstk_sz -= n+1; if (x) x->refc++; - va_start(ap, n); - while (n-- > 0) { - pure_expr *x = va_arg(ap, pure_expr*); + for (size_t i = 0; i < n+m; i++) { + pure_expr *x = sstk[sz+1+i]; + assert(x); if (x->refc > 1) x->refc--; else pure_free_internal(x); }; - va_end(ap); -#endif + interp.sstk_sz = sz; } extern "C" -void pure_pop_tail_args(pure_expr *x, uint32_t n, ...) +void pure_pop_tail_args(pure_expr *x, uint32_t n, uint32_t m) { - va_list ap; interpreter& interp = *interpreter::g_interp; -#if SSTK_DEBUG pure_expr **sstk = interp.sstk; - pure_expr **y = (pure_expr**)alloca(n*sizeof(pure_expr*)); - size_t i, sz = interp.sstk_sz, lastsz, oldsz = sz; - while (sz > 0 && sstk[--sz]) ; - assert(sz < oldsz && !sstk[sz]); - lastsz = sz; - while (sz > 0 && sstk[--sz]) ; + size_t sz, lastsz = interp.sstk_sz, oldsz = lastsz; + while (lastsz > 0 && sstk[--lastsz]) ; + assert(lastsz < oldsz && !sstk[lastsz]); + sz = lastsz-(n+m+1); assert(sz < lastsz && !sstk[sz]); - if (x) x->refc++; - va_start(ap, n); - for (i = 0; i < n; i++) { - pure_expr *x = va_arg(ap, pure_expr*); - y[i] = x; - }; - va_end(ap); - if (lastsz-sz-1 != n) goto error; - for (i = 0; i < n; i++) { - pure_expr *x = y[i]; - if (sstk[sz+i+1] != x) goto error; - } -#if SSTK_DEBUG>1 +#if SSTK_DEBUG cerr << "++ stack: (oldsz = " << oldsz << ", lastsz = " << lastsz << ")\n"; for (size_t i = 0; i < oldsz; i++) { pure_expr *x = sstk[i]; @@ -1015,62 +944,17 @@ cerr << i << ": " << "** frame **\n"; } #endif - memmove(sstk+sz, sstk+lastsz, (oldsz-lastsz)*sizeof(pure_expr*)); - oldsz -= n+1; - interp.sstk_sz = oldsz; -#if SSTK_DEBUG>1 - cerr << "++ new stack: (newsz = " << oldsz << ")\n"; - for (size_t i = 0; i < oldsz; i++) { - pure_expr *x = sstk[i]; - if (x) - cerr << i << ": " << (void*)x << ": " << x << endl; - else - cerr << i << ": " << "** frame **\n"; - } -#endif - for (size_t i = 0; i < n; i++) { - pure_expr *x = y[i]; - if (x->refc > 1) - x->refc--; - else - pure_free_internal(x); - } - return; - error: - cerr << "ERROR: can't find stack frame to be popped.\n"; - cerr << "++ stack: (oldsz = " << oldsz << ", lastsz = " << lastsz << ")\n"; - for (size_t i = 0; i < oldsz; i++) { - pure_expr *x = sstk[i]; - if (x) - cerr << i << ": " << (void*)x << ": " << x << endl; - else - cerr << i << ": " << "** frame **\n"; - } - cerr << "++ pop:\n"; - for (size_t i = 0; i < n; i++) { - pure_expr *x = y[i]; - cerr << i << ": " << (void*)x << ": " << x << endl; - } - abort(); -#else - // This doesn't verify the integrity of the shadow stack and is *much* - // faster. - pure_expr **sstk = interp.sstk; - size_t lastsz = interp.sstk_sz, oldsz = lastsz; - while (lastsz > 0 && sstk[--lastsz]) ; - memmove(sstk+lastsz-n-1, sstk+lastsz, (oldsz-lastsz)*sizeof(pure_expr*)); - interp.sstk_sz -= n+1; if (x) x->refc++; - va_start(ap, n); - while (n-- > 0) { - pure_expr *x = va_arg(ap, pure_expr*); + for (size_t i = 0; i < n+m; i++) { + pure_expr *x = sstk[sz+1+i]; + assert(x); if (x->refc > 1) x->refc--; else pure_free_internal(x); }; - va_end(ap); -#endif + memmove(sstk+sz, sstk+lastsz, (oldsz-lastsz)*sizeof(pure_expr*)); + interp.sstk_sz -= n+m+1; } extern "C" @@ -1100,36 +984,38 @@ } extern "C" -void pure_pop_arg(pure_expr *x) +void pure_pop_arg() { #if SSTK_DEBUG - pure_pop_args(0, 1, x); + pure_pop_args(0, 1, 0); #else interpreter& interp = *interpreter::g_interp; - interp.sstk_sz -= 2; + pure_expr *x = interp.sstk[interp.sstk_sz-1]; if (x->refc > 1) x->refc--; else pure_free_internal(x); + interp.sstk_sz -= 2; #endif } extern "C" -void pure_pop_tail_arg(pure_expr *x) +void pure_pop_tail_arg() { #if SSTK_DEBUG - pure_pop_tail_args(0, 1, x); + pure_pop_tail_args(0, 1, 0);... [truncated message content] |
From: <ag...@us...> - 2008-05-27 04:28:34
|
Revision: 138 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=138&view=rev Author: agraef Date: 2008-05-26 21:28:33 -0700 (Mon, 26 May 2008) Log Message: ----------- Experimental support for tail-recursive short-circuit logical operators (&& and ||). Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/interpreter.hh Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-26 20:25:34 UTC (rev 137) +++ pure/trunk/ChangeLog 2008-05-27 04:28:33 UTC (rev 138) @@ -1,3 +1,11 @@ +2008-05-27 Albert Graef <Dr....@t-...> + + * interpreter.cc (toplevel_codegen): Experimental support for + tail-recursive short-circuit logical operators (&& and ||). Note + that this makes these operations behave slightly differently (more + like if-then-else) if they form the right-hand side of an + equation. But the advantages seem to outweigh the semantic quirks. + 2008-05-26 Albert Graef <Dr....@t-...> * interpreter.cc, runtime.cc: Overhaul of the shadow stack Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-26 20:25:34 UTC (rev 137) +++ pure/trunk/interpreter.cc 2008-05-27 04:28:33 UTC (rev 138) @@ -3225,11 +3225,51 @@ void interpreter::toplevel_codegen(expr x) { +#if USE_FASTCC assert(!x.is_null()); - if (x.tag() == EXPR::COND) + if (x.tag() == EXPR::COND) { toplevel_cond(x.xval1(), x.xval2(), x.xval3()); - else - act_env().CreateRet(codegen(x)); + return; + } + Env& e = act_env(); +#if TAILOPS + Builder& b = act_builder(); + expr f; uint32_t n = count_args(x, f); + if (n == 2 && x.ttag() == EXPR::INT && + x.xval1().xval2().ttag() != EXPR::DBL && + x.xval2().ttag() != EXPR::DBL) { + if (f.ftag() == symtab.or_sym().f) { + Value *u = get_int(x.xval1().xval2()); + Value *condv = b.CreateICmpNE(u, Zero, "cond"); + BasicBlock *iftruebb = new BasicBlock("iftrue"); + BasicBlock *iffalsebb = new BasicBlock("iffalse"); + b.CreateCondBr(condv, iftruebb, iffalsebb); + e.f->getBasicBlockList().push_back(iftruebb); + b.SetInsertPoint(iftruebb); + e.CreateRet(ibox(One)); + e.f->getBasicBlockList().push_back(iffalsebb); + b.SetInsertPoint(iffalsebb); + toplevel_codegen(x.xval2()); + } else if (f.ftag() == symtab.and_sym().f) { + Value *u = get_int(x.xval1().xval2()); + Value *condv = b.CreateICmpNE(u, Zero, "cond"); + BasicBlock *iftruebb = new BasicBlock("iftrue"); + BasicBlock *iffalsebb = new BasicBlock("iffalse"); + b.CreateCondBr(condv, iftruebb, iffalsebb); + e.f->getBasicBlockList().push_back(iffalsebb); + b.SetInsertPoint(iffalsebb); + e.CreateRet(ibox(Zero)); + e.f->getBasicBlockList().push_back(iftruebb); + b.SetInsertPoint(iftruebb); + toplevel_codegen(x.xval2()); + } else + e.CreateRet(codegen(x)); + } else +#endif + e.CreateRet(codegen(x)); +#else + act_env().CreateRet(codegen(x)); +#endif } Value *interpreter::codegen(expr x) Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-05-26 20:25:34 UTC (rev 137) +++ pure/trunk/interpreter.hh 2008-05-27 04:28:33 UTC (rev 138) @@ -28,6 +28,11 @@ /* Experimental support for the "fast" calling convention which is needed to get tail call elimination. */ #define USE_FASTCC 1 +/* Experimental support for tail-recursive short-circuit logical operators (&& + and ||). This will only have an effect if USE_FASTCC is enabled. Note that + if you disable this option, && and || will still be short-curcuit, they + just won't be tail-recursive in their second operand any more. */ +#define TAILOPS 1 using namespace std; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-27 04:45:59
|
Revision: 140 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=140&view=rev Author: agraef Date: 2008-05-26 21:46:07 -0700 (Mon, 26 May 2008) Log Message: ----------- Revert previous changes which are not needed any more because && and || are now tail-recursive. Modified Paths: -------------- pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-27 04:32:49 UTC (rev 139) +++ pure/trunk/lib/prelude.pure 2008-05-27 04:46:07 UTC (rev 140) @@ -92,12 +92,12 @@ ()==() = 1; (x,xs)==() = 0; ()==(x,xs) = 0; -(x,xs)==(y,ys) = if x==y then xs==ys else 0; +(x,xs)==(y,ys) = x==y && xs==ys; ()!=() = 0; (x,xs)!=() = 1; ()!=(x,xs) = 1; -(x,xs)!=(y,ys) = if x!=y then 1 else xs!=ys; +(x,xs)!=(y,ys) = x!=y || xs!=ys; null () = 1; null (x,xs) = 0; @@ -133,12 +133,12 @@ []==[] = 1; (x:xs)==[] = 0; []==(x:xs) = 0; -(x:xs)==(y:ys) = if x==y then xs==ys else 1; +(x:xs)==(y:ys) = x==y && xs==ys; []!=[] = 0; (x:xs)!=[] = 1; []!=(x:xs) = 1; -(x:xs)!=(y:ys) = if x!=y then 1 else xs!=ys; +(x:xs)!=(y:ys) = x!=y || xs!=ys; null [] = 1; null (x:xs) = 0; @@ -207,10 +207,10 @@ functions have slightly different names). */ all p [] = 1; -all p (x:xs) = if p x then all p xs else 0; +all p (x:xs) = p x && all p xs; any p [] = 0; -any p (x:xs) = if p x then 1 else any p xs; +any p (x:xs) = p x || any p xs; do f [] = (); do f (x:xs) = do f xs when _ = f x end; Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-27 04:32:49 UTC (rev 139) +++ pure/trunk/test/prelude.log 2008-05-27 04:46:07 UTC (rev 140) @@ -334,11 +334,11 @@ ()==() = 1; (x/*0:0101*/,xs/*0:011*/)==() = 0; ()==(x/*0:101*/,xs/*0:11*/) = 0; -(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = if x/*0:0101*/==y/*0:101*/ then xs/*0:011*/==ys/*0:11*/ else 0; +(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; ()!=() = 0; (x/*0:0101*/,xs/*0:011*/)!=() = 1; ()!=(x/*0:101*/,xs/*0:11*/) = 1; -(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = if x/*0:0101*/!=y/*0:101*/ then 1 else xs/*0:011*/!=ys/*0:11*/; +(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; null () = 1; null (x/*0:101*/,xs/*0:11*/) = 0; #() = 0; @@ -407,11 +407,11 @@ []==[] = 1; x/*0:0101*/:xs/*0:011*/==[] = 0; []==x/*0:101*/:xs/*0:11*/ = 0; -x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = if x/*0:0101*/==y/*0:101*/ then xs/*0:011*/==ys/*0:11*/ else 1; +x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; []!=[] = 0; x/*0:0101*/:xs/*0:011*/!=[] = 1; []!=x/*0:101*/:xs/*0:11*/ = 1; -x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = if x/*0:0101*/!=y/*0:101*/ then 1 else xs/*0:011*/!=ys/*0:11*/; +x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; null [] = 1; null (x/*0:101*/:xs/*0:11*/) = 0; #[] = 0; @@ -629,9 +629,9 @@ state 1: #0 }) n/*0:01*/; all p/*0:01*/ [] = 1; -all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = if p/*0:01*/ x/*0:101*/ then all p/*0:01*/ xs/*0:11*/ else 0; +all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/&&all p/*0:01*/ xs/*0:11*/; any p/*0:01*/ [] = 0; -any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = if p/*0:01*/ x/*0:101*/ then 1 else any p/*0:01*/ xs/*0:11*/; +any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/||any p/*0:01*/ xs/*0:11*/; do f/*0:01*/ [] = (); do f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = do f/*1:01*/ xs/*1:11*/ when _/*0:*/ = f/*0:01*/ x/*0:101*/ { rule #0: _ = f x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-27 09:28:37
|
Revision: 144 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=144&view=rev Author: agraef Date: 2008-05-27 02:28:46 -0700 (Tue, 27 May 2008) Log Message: ----------- Disable TCO of logical operators, it's broken by design. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/interpreter.hh pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-27 09:18:50 UTC (rev 143) +++ pure/trunk/ChangeLog 2008-05-27 09:28:46 UTC (rev 144) @@ -1,10 +1,10 @@ 2008-05-27 Albert Graef <Dr....@t-...> * interpreter.cc (toplevel_codegen): Experimental support for - tail-recursive short-circuit logical operators (&& and ||). Note - that this makes these operations behave slightly differently (more - like if-then-else) if they form the right-hand side of an - equation. But the advantages seem to outweigh the semantic quirks. + tail-recursive logical operators (&& and ||). This works but is + disabled, since it makes these operations behave in different ways + depending on the context, which is a really bad idea because it + violates referential transparency. 2008-05-26 Albert Graef <Dr....@t-...> Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-27 09:18:50 UTC (rev 143) +++ pure/trunk/interpreter.cc 2008-05-27 09:28:46 UTC (rev 144) @@ -3224,6 +3224,11 @@ return 0; } +/* Experimental support for tail-recursive logical operators (&& and ||). This + works, but is inherently broken (e.g., 0||-1 might return either -1 or 1, + depending on whether the code is TCO'ed or not). Never use this. */ +#define TAILOPS 0 + void interpreter::toplevel_codegen(expr x) { #if USE_FASTCC Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-05-27 09:18:50 UTC (rev 143) +++ pure/trunk/interpreter.hh 2008-05-27 09:28:46 UTC (rev 144) @@ -28,11 +28,6 @@ /* Experimental support for the "fast" calling convention which is needed to get tail call elimination. */ #define USE_FASTCC 1 -/* Experimental support for tail-recursive short-circuit logical operators (&& - and ||). This will only have an effect if USE_FASTCC is enabled. Note that - if you disable this option, && and || will still be short-curcuit, they - just won't be tail-recursive in their second operand any more. */ -#define TAILOPS 1 using namespace std; Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-27 09:18:50 UTC (rev 143) +++ pure/trunk/lib/prelude.pure 2008-05-27 09:28:46 UTC (rev 144) @@ -98,12 +98,12 @@ ()==() = 1; (x,xs)==() = 0; ()==(x,xs) = 0; -(x,xs)==(y,ys) = x==y && xs==ys; +(x,xs)==(y,ys) = if x==y then xs==ys else 0; ()!=() = 0; (x,xs)!=() = 1; ()!=(x,xs) = 1; -(x,xs)!=(y,ys) = x!=y || xs!=ys; +(x,xs)!=(y,ys) = if x!=y then 1 else xs!=ys; null () = 1; null (x,xs) = 0; @@ -136,12 +136,12 @@ []==[] = 1; (x:xs)==[] = 0; []==(x:xs) = 0; -(x:xs)==(y:ys) = x==y && xs==ys; +(x:xs)==(y:ys) = if x==y then xs==ys else 1; []!=[] = 0; (x:xs)!=[] = 1; []!=(x:xs) = 1; -(x:xs)!=(y:ys) = x!=y || xs!=ys; +(x:xs)!=(y:ys) = if x!=y then 1 else xs!=ys; null [] = 1; null (x:xs) = 0; @@ -214,10 +214,10 @@ to make them tail-recursive. */ all p [] = 1; -all p (x:xs) = p x && all p xs; +all p (x:xs) = if p x then all p xs else 0; any p [] = 0; -any p (x:xs) = p x || any p xs; +any p (x:xs) = if p x then 1 else any p xs; do f [] = (); do f (x:xs) = do f xs when _ = f x end; Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-27 09:18:50 UTC (rev 143) +++ pure/trunk/test/prelude.log 2008-05-27 09:28:46 UTC (rev 144) @@ -338,11 +338,11 @@ ()==() = 1; (x/*0:0101*/,xs/*0:011*/)==() = 0; ()==(x/*0:101*/,xs/*0:11*/) = 0; -(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; +(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = if x/*0:0101*/==y/*0:101*/ then xs/*0:011*/==ys/*0:11*/ else 0; ()!=() = 0; (x/*0:0101*/,xs/*0:011*/)!=() = 1; ()!=(x/*0:101*/,xs/*0:11*/) = 1; -(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; +(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = if x/*0:0101*/!=y/*0:101*/ then 1 else xs/*0:011*/!=ys/*0:11*/; null () = 1; null (x/*0:101*/,xs/*0:11*/) = 0; #() = 0; @@ -412,11 +412,11 @@ []==[] = 1; x/*0:0101*/:xs/*0:011*/==[] = 0; []==x/*0:101*/:xs/*0:11*/ = 0; -x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; +x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = if x/*0:0101*/==y/*0:101*/ then xs/*0:011*/==ys/*0:11*/ else 1; []!=[] = 0; x/*0:0101*/:xs/*0:011*/!=[] = 1; []!=x/*0:101*/:xs/*0:11*/ = 1; -x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; +x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = if x/*0:0101*/!=y/*0:101*/ then 1 else xs/*0:011*/!=ys/*0:11*/; null [] = 1; null (x/*0:101*/:xs/*0:11*/) = 0; #[] = 0; @@ -640,9 +640,9 @@ state 1: #0 }) n/*0:01*/; all p/*0:01*/ [] = 1; -all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/&&all p/*0:01*/ xs/*0:11*/; +all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = if p/*0:01*/ x/*0:101*/ then all p/*0:01*/ xs/*0:11*/ else 0; any p/*0:01*/ [] = 0; -any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/||any p/*0:01*/ xs/*0:11*/; +any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = if p/*0:01*/ x/*0:101*/ then 1 else any p/*0:01*/ xs/*0:11*/; do f/*0:01*/ [] = (); do f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = do f/*1:01*/ xs/*1:11*/ when _/*0:*/ = f/*0:01*/ x/*0:101*/ { rule #0: _ = f x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-27 18:13:52
|
Revision: 145 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=145&view=rev Author: agraef Date: 2008-05-27 11:13:58 -0700 (Tue, 27 May 2008) Log Message: ----------- Overhaul of prelude. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-27 09:28:46 UTC (rev 144) +++ pure/trunk/ChangeLog 2008-05-27 18:13:58 UTC (rev 145) @@ -1,5 +1,8 @@ 2008-05-27 Albert Graef <Dr....@t-...> + * lib/prelude.pure: Rewrite prelude operations to make them + tail-recursive. + * interpreter.cc (toplevel_codegen): Experimental support for tail-recursive logical operators (&& and ||). This works but is disabled, since it makes these operations behave in different ways @@ -16,9 +19,6 @@ 2008-05-25 Albert Graef <Dr....@t-...> - * lib/prelude.pure: Rewrite prelude operations to make them - tail-recursive. - * interpreter.cc, runtime.cc: Add marshalling between long (64 bit) ints and Pure bigints in the C interface. This means that both Pure ints and bigints can now be passed for 'long' arguments Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-27 09:28:46 UTC (rev 144) +++ pure/trunk/lib/prelude.pure 2008-05-27 18:13:58 UTC (rev 145) @@ -28,16 +28,16 @@ nullary failed_match; // failed pattern match (lambda, case, etc.) nullary stack_fault; // not enough stack space (PURE_STACK limit) -/* Other exceptions defined by the prelude. Note that some of the list - operations require that their list arguments are "proper" lists (ending in - []) and will raise a 'bad_list_value xs' exception otherwise; in this case - xs denotes the offending tail. Likewise, some operations will raise the - 'empty_list' exception if a nonempty list is required. */ +/* Other exceptions defined by the prelude. We use exceptions sparingly, to + not interfere with symbolic evaluation, but in some cases it makes sense to + raise special kinds of exceptions in response to obvious error conditions. + In particular, the 'bad_list_value' exception is raised by functions which + need to work from the end of a list towards its front. */ nullary out_of_bounds; // tuple or list index is out of bounds (!) nullary empty_list; // empty list (head, tail, etc.) // bad_list_value xs; // not a proper list value (reverse, etc.) -// bad_value x; // invalid argument type + // xs denotes the offending tail of the list /* Other constants. */ @@ -114,10 +114,10 @@ accum n::int x = n+1; end; +(x,xs)!n::int = throw out_of_bounds if n<0; (x,xs)!0 = x; -(x,y,xs)!n::int = (y,xs)!(n-1) if n>0; +(x,y,xs)!n::int = (y,xs)!(n-1); (x,y)!1 = y; -(x,xs)!n::int = throw out_of_bounds; reverse () = (); reverse (x,xs) = accum x xs with @@ -150,12 +150,12 @@ #(x:xs) = accum 1 xs with accum n::int (x:xs) = accum (n+1) xs; accum n::int [] = n; - accum _ xs = throw (bad_list_value xs); + accum n::int xs = n+#xs; end; +(x,xs)!n::int = throw out_of_bounds if n<0; (x:xs)!0 = x; -(x:xs)!n::int = xs!(n-1) if n>0 && assert (listnp xs) (bad_list_value xs); -(x:xs)!n::int = throw out_of_bounds; +(x:xs)!n::int = xs!(n-1); []!n::int = throw out_of_bounds; []+ys = ys; @@ -183,7 +183,7 @@ tuple (x:xs) = accum x xs with accum ys (x:xs) = accum (x,ys) xs; accum ys [] = if tuplep ys then reverse ys else ys; - accum _ xs = throw (bad_list_value xs); + accum ys xs = ys,xs; end; /* Slicing. xs!ns returns the list of xs!n for all members n of the index list @@ -192,11 +192,13 @@ structures defined above. */ xs![] = []; -xs!(n:ns) = accum [] (reverse (n:ns)) with - accum ys [] = ys; +xs!(n:ns) = accum [] (n:ns) with + accum ys [] = reverse ys; accum ys (n::int:ns) = accum (xs!n:ys) ns if n>=0 && n<m; = accum ys ns otherwise; - accum _ (n:_) = throw (bad_value n); + accum ys (n:ns) = accum (xs!n:ys) ns if n>=0 && n<m; + = accum ys ns otherwise; + accum ys ns = reverse ys+xs!ns; end when m::int = #xs end; /* Arithmetic sequences. */ @@ -222,9 +224,10 @@ do f [] = (); do f (x:xs) = do f xs when _ = f x end; -drop n [] = []; -drop n (x:xs) = drop (n-1) xs if n>0; - = (x:xs) otherwise; +drop n::int [] = []; +drop n::int (x:xs) + = drop (n-1) xs if n>0; + = x:xs otherwise; dropwhile p [] = []; dropwhile p (x:xs) @@ -232,8 +235,12 @@ = x:xs otherwise; filter p [] = []; -filter p (x:xs) = x:filter p xs if p x; - = filter p xs otherwise; +filter p (x:xs) = accum [] (x:xs) with + accum ys [] = reverse ys; + accum ys (x:xs) = accum (x:ys) xs if p x; + = accum ys xs otherwise; + accum ys xs = reverse ys+filter p xs; + end; foldl f a [] = a; foldl f a (x:xs) @@ -246,30 +253,44 @@ = f x (foldl (flip f) a (reverse xs)); foldr1 f [x] = x; -foldr1 f (x:y:xs) - = f x (foldl1 (flip f) (reverse (y:xs))); +foldr1 f (x:xs) = foldr f x xs; head (x:xs) = x; +head [] = throw empty_list; init [x] = []; -init (x:xs) = x:init xs; +init (x:xs) = accum [x] xs with + accum ys [] = reverse ys; + accum ys (x:xs) = accum (x:ys) xs; + accum ys xs = reverse ys+init xs; + end; +init [] = throw empty_list; last [x] = x; last (x:xs) = last xs; +last [] = throw empty_list; map f [] = []; -map f (x:xs) = f x:map f xs; +map f (x:xs) = accum [f x] xs with + accum ys [] = reverse ys; + accum ys (x:xs) = accum (f x:ys) xs; + accum ys xs = reverse ys+map f xs; + end; scanl f a [] = [a]; scanl f a (x:xs) - = accum [a] f (f a x) xs with - accum ys f a [] = reverse (a:ys); - accum ys f a (x:xs) = accum (a:ys) f (f a x) xs; - accum _ _ _ xs = throw (bad_list_value xs); + = accum [a] (f a x) xs with + accum ys a [] = reverse (a:ys); + accum ys a (x:xs) = accum (a:ys) (f a x) xs; + accum _ _ xs = throw (bad_list_value xs); end; scanl1 f [] = []; -scanl1 f (x:xs) = scanl f x xs; +scanl1 f (x:xs) = accum [] x xs with + accum ys a [] = reverse (a:ys); + accum ys a (x:xs) = accum (a:ys) (f a x) xs; + accum _ _ xs = throw (bad_list_value xs); + end; scanr f a [] = [a]; scanr f a (x:xs) @@ -286,15 +307,26 @@ end; tail (x:xs) = xs; +tail [] = throw empty_list; -take n [] = []; -take n (x:xs) = x:take (n-1) xs if n>0; - = [] otherwise; +take n::int [] = []; +take n::int (x:xs) + = accum n [] (x:xs) with + accum _ ys [] = reverse ys; + accum n::int ys _ = reverse ys if n<=0; + accum n::int ys (x:xs) + = accum (n-1) (x:ys) xs; + accum n ys xs = reverse ys+take n xs; + end; takewhile p [] = []; takewhile p (x:xs) - = x:takewhile p xs if p x; - = [] otherwise; + = accum [] (x:xs) with + accum ys [] = reverse ys; + accum ys (x:xs) = accum (x:ys) xs if p x; + = reverse ys otherwise; + accum ys xs = reverse ys+takewhile p xs; + end; /* Concatenate a list of lists. */ @@ -340,22 +372,25 @@ /* zip, unzip and friends. */ -zip (x:xs) (y:ys) - = (x,y):zip xs ys; -zip _ _ = [] otherwise; +zip xs ys = accum [] xs ys with + accum us (x:xs) (y:ys) = accum ((x,y):us) xs ys; + accum us _ _ = reverse us; +end; -zip3 (x:xs) (y:ys) (z:zs) - = (x,y,z):zip3 xs ys zs; -zip3 _ _ _ = [] otherwise; +zip3 xs ys zs = accum [] xs ys zs with + accum us (x:xs) (y:ys) (z:zs) = accum ((x,y,z):us) xs ys zs; + accum us _ _ _ = reverse us; +end; -zipwith f (x:xs) (y:ys) - = f x y:zipwith f xs ys; -zipwith f _ _ = [] otherwise; +zipwith f xs ys = accum [] xs ys with + accum us (x:xs) (y:ys) = accum (f x y:us) xs ys; + accum us _ _ = reverse us; +end; -zipwith3 f (x:xs) (y:ys) (z:zs) - = f x y z:zipwith3 f xs ys zs; -zipwith3 f _ _ _ - = [] otherwise; +zipwith3 f xs ys zs = accum [] xs ys zs with + accum us (x:xs) (y:ys) (z:zs) = accum (f x y z:us) xs ys zs; + accum us _ _ _ = reverse us; +end; dowith f (x:xs) (y:ys) = dowith f xs ys when _ = f x y end; @@ -365,10 +400,18 @@ = dowith3 f xs ys zs when _ = f x y z end; dowith3 f _ _ _ = () otherwise; -unzip ((x,y):us) - = x:xs,y:ys when xs,ys = unzip us end; unzip [] = [],[]; +unzip ((x,y):us) = x:xs,y:ys when xs,ys = accum [] [] us end +with + accum xs ys [] = reverse xs,reverse ys; + accum xs ys ((x,y):us) = accum (x:xs) (y:ys) us; + accum _ _ us = throw (bad_list_value us); +end; -unzip3 ((x,y,z):us) - = x:xs,y:ys,z:zs when xs,ys,zs = unzip3 us end; unzip3 [] = [],[],[]; +unzip3 ((x,y,z):us) = x:xs,y:ys,z:zs when xs,ys,zs = accum [] [] [] us end +with + accum xs ys zs [] = reverse xs,reverse ys,reverse zs; + accum xs ys zs ((x,y,z):us) = accum (x:xs) (y:ys) (z:zs) us; + accum _ _ _ us = throw (bad_list_value us); +end; Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-27 09:28:46 UTC (rev 144) +++ pure/trunk/test/prelude.log 2008-05-27 18:13:58 UTC (rev 145) @@ -375,10 +375,10 @@ <var> state 12 state 12: #0 #1 } end; +(x/*0:0101*/,xs/*0:011*/)!n/*0:1*/::int = throw out_of_bounds if n/*0:1*/<0; (x/*0:0101*/,xs/*0:011*/)!0 = x/*0:0101*/; -(x/*0:0101*/,y/*0:01101*/,xs/*0:0111*/)!n/*0:1*/::int = (y/*0:01101*/,xs/*0:0111*/)!(n/*0:1*/-1) if n/*0:1*/>0; +(x/*0:0101*/,y/*0:01101*/,xs/*0:0111*/)!n/*0:1*/::int = (y/*0:01101*/,xs/*0:0111*/)!(n/*0:1*/-1); (x/*0:0101*/,y/*0:011*/)!1 = y/*0:011*/; -(x/*0:0101*/,xs/*0:011*/)!n/*0:1*/::int = throw out_of_bounds; reverse () = (); reverse (x/*0:101*/,xs/*0:11*/) = accum/*0*/ x/*0:101*/ xs/*0:11*/ with accum ys/*0:01*/ (x/*0:101*/,xs/*0:11*/) = accum/*1*/ (x/*0:101*/,ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ x/*0:1*/ = x/*0:1*/,ys/*0:01*/ { rule #0: accum ys (x,xs) = accum (x,ys) xs @@ -420,45 +420,41 @@ null [] = 1; null (x/*0:101*/:xs/*0:11*/) = 0; #[] = 0; -#(x/*0:101*/:xs/*0:11*/) = accum/*0*/ 1 xs/*0:11*/ with accum n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (n/*0:01*/+1) xs/*0:11*/; accum n/*0:01*/::int [] = n/*0:01*/; accum _/*0:01*/ xs/*0:1*/ = throw (bad_list_value xs/*0:1*/) { +#(x/*0:101*/:xs/*0:11*/) = accum/*0*/ 1 xs/*0:11*/ with accum n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (n/*0:01*/+1) xs/*0:11*/; accum n/*0:01*/::int [] = n/*0:01*/; accum n/*0:01*/::int xs/*0:1*/ = n/*0:01*/+#xs/*0:1*/ { rule #0: accum n::int (x:xs) = accum (n+1) xs rule #1: accum n::int [] = n - rule #2: accum _ xs = throw (bad_list_value xs) + rule #2: accum n::int xs = n+#xs state 0: #0 #1 #2 - <var> state 1 - <var>::int state 3 - state 1: #2 + <var>::int state 1 + state 1: #0 #1 #2 <var> state 2 + <app> state 3 + [] state 13 state 2: #2 - state 3: #0 #1 #2 + state 3: #0 #2 <var> state 4 - <app> state 5 - [] state 15 + <app> state 6 state 4: #2 - state 5: #0 #2 - <var> state 6 - <app> state 8 - state 6: #2 + <var> state 5 + state 5: #2 + state 6: #0 #2 <var> state 7 + : state 10 state 7: #2 - state 8: #0 #2 + <var> state 8 + state 8: #2 <var> state 9 - : state 12 state 9: #2 - <var> state 10 - state 10: #2 + state 10: #0 #2 <var> state 11 - state 11: #2 + state 11: #0 #2 + <var> state 12 state 12: #0 #2 - <var> state 13 - state 13: #0 #2 - <var> state 14 - state 14: #0 #2 - state 15: #1 #2 + state 13: #1 #2 } end; +(x/*0:0101*/,xs/*0:011*/)!n/*0:1*/::int = throw out_of_bounds if n/*0:1*/<0; (x/*0:0101*/:xs/*0:011*/)!0 = x/*0:0101*/; -(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = xs/*0:011*/!(n/*0:1*/-1) if n/*0:1*/>0&&assert (listnp xs/*0:011*/) (bad_list_value xs/*0:011*/); -(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = throw out_of_bounds; +(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = xs/*0:011*/!(n/*0:1*/-1); []!n/*0:1*/::int = throw out_of_bounds; []+ys/*0:1*/ = ys/*0:1*/; (x/*0:0101*/:xs/*0:011*/)+ys/*0:1*/ = x/*0:0101*/:accum/*0*/ ys/*0:1*/ (reverse xs/*0:011*/) with accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ [] = ys/*0:01*/ { @@ -544,10 +540,10 @@ state 12: #0 #1 } end; tuple [] = (); -tuple (x/*0:101*/:xs/*0:11*/) = accum/*0*/ x/*0:101*/ xs/*0:11*/ with accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/,ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ [] = if tuplep ys/*0:01*/ then reverse ys/*0:01*/ else ys/*0:01*/; accum _/*0:01*/ xs/*0:1*/ = throw (bad_list_value xs/*0:1*/) { +tuple (x/*0:101*/:xs/*0:11*/) = accum/*0*/ x/*0:101*/ xs/*0:11*/ with accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/,ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ [] = if tuplep ys/*0:01*/ then reverse ys/*0:01*/ else ys/*0:01*/; accum ys/*0:01*/ xs/*0:1*/ = ys/*0:01*/,xs/*0:1*/ { rule #0: accum ys (x:xs) = accum (x,ys) xs rule #1: accum ys [] = if tuplep ys then reverse ys else ys - rule #2: accum _ xs = throw (bad_list_value xs) + rule #2: accum ys xs = ys,xs state 0: #0 #1 #2 <var> state 1 state 1: #0 #1 #2 @@ -577,30 +573,44 @@ state 13: #1 #2 } end; xs/*0:01*/![] = []; -xs/*0:01*/!(n/*0:101*/:ns/*0:11*/) = accum/*0*/ [] (reverse (n/*1:101*/:ns/*1:11*/)) with accum ys/*0:01*/ [] = ys/*0:01*/; accum ys/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = accum/*1*/ (xs/*2:01*/!n/*0:101*/:ys/*0:01*/) ns/*0:11*/ if n/*0:101*/>=0&&n/*0:101*/<m/*1:*/; accum ys/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = accum/*1*/ ys/*0:01*/ ns/*0:11*/; accum _/*0:01*/ (n/*0:101*/:_/*0:11*/) = throw (bad_value n/*0:101*/) { - rule #0: accum ys [] = ys +xs/*0:01*/!(n/*0:101*/:ns/*0:11*/) = accum/*0*/ [] (n/*1:101*/:ns/*1:11*/) with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = accum/*1*/ (xs/*2:01*/!n/*0:101*/:ys/*0:01*/) ns/*0:11*/ if n/*0:101*/>=0&&n/*0:101*/<m/*1:*/; accum ys/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = accum/*1*/ ys/*0:01*/ ns/*0:11*/; accum ys/*0:01*/ (n/*0:101*/:ns/*0:11*/) = accum/*1*/ (xs/*2:01*/!n/*0:101*/:ys/*0:01*/) ns/*0:11*/ if n/*0:101*/>=0&&n/*0:101*/<m/*1:*/; accum ys/*0:01*/ (n/*0:101*/:ns/*0:11*/) = accum/*1*/ ys/*0:01*/ ns/*0:11*/; accum ys/*0:01*/ ns/*0:1*/ = reverse ys/*0:01*/+xs/*2:01*/!ns/*0:1*/ { + rule #0: accum ys [] = reverse ys rule #1: accum ys (n::int:ns) = accum (xs!n:ys) ns if n>=0&&n<m rule #2: accum ys (n::int:ns) = accum ys ns - rule #3: accum _ (n:_) = throw (bad_value n) - state 0: #0 #1 #2 #3 + rule #3: accum ys (n:ns) = accum (xs!n:ys) ns if n>=0&&n<m + rule #4: accum ys (n:ns) = accum ys ns + rule #5: accum ys ns = reverse ys+xs!ns + state 0: #0 #1 #2 #3 #4 #5 <var> state 1 - state 1: #0 #1 #2 #3 - [] state 2 - <app> state 3 - state 2: #0 - state 3: #1 #2 #3 + state 1: #0 #1 #2 #3 #4 #5 + <var> state 2 + [] state 3 <app> state 4 - state 4: #1 #2 #3 - : state 5 - state 5: #1 #2 #3 + state 2: #5 + state 3: #0 #5 + state 4: #1 #2 #3 #4 #5 + <var> state 5 + <app> state 7 + state 5: #5 <var> state 6 - <var>::int state 8 - state 6: #3 - <var> state 7 - state 7: #3 - state 8: #1 #2 #3 + state 6: #5 + state 7: #1 #2 #3 #4 #5 + <var> state 8 + : state 11 + state 8: #5 <var> state 9 - state 9: #1 #2 #3 + state 9: #5 + <var> state 10 + state 10: #5 + state 11: #1 #2 #3 #4 #5 + <var> state 12 + <var>::int state 14 + state 12: #3 #4 #5 + <var> state 13 + state 13: #3 #4 #5 + state 14: #1 #2 #3 #4 #5 + <var> state 15 + state 15: #1 #2 #3 #4 #5 } end when m/*0:*/::int = #xs/*0:01*/ { rule #0: m::int = #xs state 0: #0 @@ -650,68 +660,195 @@ <var> state 1 state 1: #0 } end; -drop n/*0:01*/ [] = []; -drop n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = drop (n/*0:01*/-1) xs/*0:11*/ if n/*0:01*/>0; -drop n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:xs/*0:11*/; +drop n/*0:01*/::int [] = []; +drop n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = drop (n/*0:01*/-1) xs/*0:11*/ if n/*0:01*/>0; +drop n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:xs/*0:11*/; dropwhile p/*0:01*/ [] = []; dropwhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = dropwhile p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; dropwhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:xs/*0:11*/; filter p/*0:01*/ [] = []; -filter p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:filter p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; -filter p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = filter p/*0:01*/ xs/*0:11*/; +filter p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [] (x/*0:101*/:xs/*0:11*/) with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/ if p/*1:01*/ x/*0:101*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ ys/*0:01*/ xs/*0:11*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+filter p/*1:01*/ xs/*0:1*/ { + rule #0: accum ys [] = reverse ys + rule #1: accum ys (x:xs) = accum (x:ys) xs if p x + rule #2: accum ys (x:xs) = accum ys xs + rule #3: accum ys xs = reverse ys+filter p xs + state 0: #0 #1 #2 #3 + <var> state 1 + state 1: #0 #1 #2 #3 + <var> state 2 + [] state 3 + <app> state 4 + state 2: #3 + state 3: #0 #3 + state 4: #1 #2 #3 + <var> state 5 + <app> state 7 + state 5: #3 + <var> state 6 + state 6: #3 + state 7: #1 #2 #3 + <var> state 8 + : state 11 + state 8: #3 + <var> state 9 + state 9: #3 + <var> state 10 + state 10: #3 + state 11: #1 #2 #3 + <var> state 12 + state 12: #1 #2 #3 + <var> state 13 + state 13: #1 #2 #3 +} end; foldl f/*0:001*/ a/*0:01*/ [] = a/*0:01*/; foldl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldl f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; foldl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldl f/*0:01*/ x/*0:101*/ xs/*0:11*/; foldr f/*0:001*/ a/*0:01*/ [] = a/*0:01*/; foldr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:001*/ x/*0:101*/ (foldl (flip f/*0:001*/) a/*0:01*/ (reverse xs/*0:11*/)); foldr1 f/*0:01*/ [x/*0:101*/] = x/*0:101*/; -foldr1 f/*0:01*/ (x/*0:101*/:y/*0:1101*/:xs/*0:111*/) = f/*0:01*/ x/*0:101*/ (foldl1 (flip f/*0:01*/) (reverse (y/*0:1101*/:xs/*0:111*/))); +foldr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldr f/*0:01*/ x/*0:101*/ xs/*0:11*/; head (x/*0:101*/:xs/*0:11*/) = x/*0:101*/; +head [] = throw empty_list; init [x/*0:101*/] = []; -init (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:init xs/*0:11*/; +init (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [x/*0:101*/] xs/*0:11*/ with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+init xs/*0:1*/ { + rule #0: accum ys [] = reverse ys + rule #1: accum ys (x:xs) = accum (x:ys) xs + rule #2: accum ys xs = reverse ys+init xs + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + [] state 3 + <app> state 4 + state 2: #2 + state 3: #0 #2 + state 4: #1 #2 + <var> state 5 + <app> state 7 + state 5: #2 + <var> state 6 + state 6: #2 + state 7: #1 #2 + <var> state 8 + : state 11 + state 8: #2 + <var> state 9 + state 9: #2 + <var> state 10 + state 10: #2 + state 11: #1 #2 + <var> state 12 + state 12: #1 #2 + <var> state 13 + state 13: #1 #2 +} end; +init [] = throw empty_list; last [x/*0:101*/] = x/*0:101*/; last (x/*0:101*/:xs/*0:11*/) = last xs/*0:11*/; +last [] = throw empty_list; map f/*0:01*/ [] = []; -map f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:01*/ x/*0:101*/:map f/*0:01*/ xs/*0:11*/; +map f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [f/*0:01*/ x/*0:101*/] xs/*0:11*/ with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (f/*1:01*/ x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+map f/*1:01*/ xs/*0:1*/ { + rule #0: accum ys [] = reverse ys + rule #1: accum ys (x:xs) = accum (f x:ys) xs + rule #2: accum ys xs = reverse ys+map f xs + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + [] state 3 + <app> state 4 + state 2: #2 + state 3: #0 #2 + state 4: #1 #2 + <var> state 5 + <app> state 7 + state 5: #2 + <var> state 6 + state 6: #2 + state 7: #1 #2 + <var> state 8 + : state 11 + state 8: #2 + <var> state 9 + state 9: #2 + <var> state 10 + state 10: #2 + state 11: #1 #2 + <var> state 12 + state 12: #1 #2 + <var> state 13 + state 13: #1 #2 +} end; scanl f/*0:001*/ a/*0:01*/ [] = [a/*0:01*/]; -scanl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [a/*0:01*/] f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/ with accum ys/*0:0001*/ f/*0:001*/ a/*0:01*/ [] = reverse (a/*0:01*/:ys/*0:0001*/); accum ys/*0:0001*/ f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (a/*0:01*/:ys/*0:0001*/) f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; accum _/*0:0001*/ _/*0:001*/ _/*0:01*/ xs/*0:1*/ = throw (bad_list_value xs/*0:1*/) { - rule #0: accum ys f a [] = reverse (a:ys) - rule #1: accum ys f a (x:xs) = accum (a:ys) f (f a x) xs - rule #2: accum _ _ _ xs = throw (bad_list_value xs) +scanl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [a/*0:01*/] (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/ with accum ys/*0:001*/ a/*0:01*/ [] = reverse (a/*0:01*/:ys/*0:001*/); accum ys/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (a/*0:01*/:ys/*0:001*/) (f/*1:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; accum _/*0:001*/ _/*0:01*/ xs/*0:1*/ = throw (bad_list_value xs/*0:1*/) { + rule #0: accum ys a [] = reverse (a:ys) + rule #1: accum ys a (x:xs) = accum (a:ys) (f a x) xs + rule #2: accum _ _ xs = throw (bad_list_value xs) state 0: #0 #1 #2 <var> state 1 state 1: #0 #1 #2 <var> state 2 state 2: #0 #1 #2 <var> state 3 - state 3: #0 #1 #2 - <var> state 4 - [] state 5 - <app> state 6 - state 4: #2 - state 5: #0 #2 - state 6: #1 #2 + [] state 4 + <app> state 5 + state 3: #2 + state 4: #0 #2 + state 5: #1 #2 + <var> state 6 + <app> state 8 + state 6: #2 <var> state 7 - <app> state 9 state 7: #2 - <var> state 8 - state 8: #2 - state 9: #1 #2 + state 8: #1 #2 + <var> state 9 + : state 12 + state 9: #2 <var> state 10 - : state 13 state 10: #2 <var> state 11 state 11: #2 - <var> state 12 - state 12: #2 + state 12: #1 #2 + <var> state 13 state 13: #1 #2 <var> state 14 state 14: #1 #2 - <var> state 15 - state 15: #1 #2 } end; scanl1 f/*0:01*/ [] = []; -scanl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = scanl f/*0:01*/ x/*0:101*/ xs/*0:11*/; +scanl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [] x/*0:101*/ xs/*0:11*/ with accum ys/*0:001*/ a/*0:01*/ [] = reverse (a/*0:01*/:ys/*0:001*/); accum ys/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (a/*0:01*/:ys/*0:001*/) (f/*1:01*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; accum _/*0:001*/ _/*0:01*/ xs/*0:1*/ = throw (bad_list_value xs/*0:1*/) { + rule #0: accum ys a [] = reverse (a:ys) + rule #1: accum ys a (x:xs) = accum (a:ys) (f a x) xs + rule #2: accum _ _ xs = throw (bad_list_value xs) + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + state 2: #0 #1 #2 + <var> state 3 + [] state 4 + <app> state 5 + state 3: #2 + state 4: #0 #2 + state 5: #1 #2 + <var> state 6 + <app> state 8 + state 6: #2 + <var> state 7 + state 7: #2 + state 8: #1 #2 + <var> state 9 + : state 12 + state 9: #2 + <var> state 10 + state 10: #2 + <var> state 11 + state 11: #2 + state 12: #1 #2 + <var> state 13 + state 13: #1 #2 + <var> state 14 + state 14: #1 #2 +} end; scanr f/*0:001*/ a/*0:01*/ [] = [a/*0:01*/]; scanr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:001*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = reverse (scanl (flip f/*0:001*/) a/*0:01*/ (reverse xs/*0:11*/)); y/*0:01*/:_/*0:1*/ = ys/*0:*/ { rule #0: y:_ = ys @@ -754,12 +891,85 @@ state 1: #0 } end; tail (x/*0:101*/:xs/*0:11*/) = xs/*0:11*/; -take n/*0:01*/ [] = []; -take n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:take (n/*0:01*/-1) xs/*0:11*/ if n/*0:01*/>0; -take n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = []; +tail [] = throw empty_list; +take n/*0:01*/::int [] = []; +take n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = accum/*0*/ n/*0:01*/ [] (x/*0:101*/:xs/*0:11*/) with accum _/*0:001*/ ys/*0:01*/ [] = reverse ys/*0:01*/; accum n/*0:001*/::int ys/*0:01*/ _/*0:1*/ = reverse ys/*0:01*/ if n/*0:001*/<=0; accum n/*0:001*/::int ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (n/*0:001*/-1) (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum n/*0:001*/ ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+take n/*0:001*/ xs/*0:1*/ { + rule #0: accum _ ys [] = reverse ys + rule #1: accum n::int ys _ = reverse ys if n<=0 + rule #2: accum n::int ys (x:xs) = accum (n-1) (x:ys) xs + rule #3: accum n ys xs = reverse ys+take n xs + state 0: #0 #1 #2 #3 + <var> state 1 + <var>::int state 5 + state 1: #0 #3 + <var> state 2 + state 2: #0 #3 + <var> state 3 + [] state 4 + state 3: #3 + state 4: #0 #3 + state 5: #0 #1 #2 #3 + <var> state 6 + state 6: #0 #1 #2 #3 + <var> state 7 + [] state 8 + <app> state 9 + state 7: #1 #3 + state 8: #0 #1 #3 + state 9: #1 #2 #3 + <var> state 10 + <app> state 12 + state 10: #1 #3 + <var> state 11 + state 11: #1 #3 + state 12: #1 #2 #3 + <var> state 13 + : state 16 + state 13: #1 #3 + <var> state 14 + state 14: #1 #3 + <var> state 15 + state 15: #1 #3 + state 16: #1 #2 #3 + <var> state 17 + state 17: #1 #2 #3 + <var> state 18 + state 18: #1 #2 #3 +} end; takewhile p/*0:01*/ [] = []; -takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:takewhile p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; -takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = []; +takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [] (x/*0:101*/:xs/*0:11*/) with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/ if p/*1:01*/ x/*0:101*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = reverse ys/*0:01*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+takewhile p/*1:01*/ xs/*0:1*/ { + rule #0: accum ys [] = reverse ys + rule #1: accum ys (x:xs) = accum (x:ys) xs if p x + rule #2: accum ys (x:xs) = reverse ys + rule #3: accum ys xs = reverse ys+takewhile p xs + state 0: #0 #1 #2 #3 + <var> state 1 + state 1: #0 #1 #2 #3 + <var> state 2 + [] state 3 + <app> state 4 + state 2: #3 + state 3: #0 #3 + state 4: #1 #2 #3 + <var> state 5 + <app> state 7 + state 5: #3 + <var> state 6 + state 6: #3 + state 7: #1 #2 #3 + <var> state 8 + : state 11 + state 8: #3 + <var> state 9 + state 9: #3 + <var> state 10 + state 10: #3 + state 11: #1 #2 #3 + <var> state 12 + state 12: #1 #2 #3 + <var> state 13 + state 13: #1 #2 #3 +} end; cat [] = []; cat [xs/*0:101*/] = xs/*0:101*/; cat (xs/*0:101*/:xss/*0:11*/) = accum/*0*/ (reverse xs/*0:101*/) xss/*0:11*/ with accum xs/*0:01*/ [] = reverse xs/*0:01*/; accum xs/*0:01*/ ([]:yss/*0:11*/) = accum/*1*/ xs/*0:01*/ yss/*0:11*/; accum xs/*0:01*/ ((y/*0:10101*/:ys/*0:1011*/):yss/*0:11*/) = accum/*1*/ (y/*0:10101*/:xs/*0:01*/) (ys/*0:1011*/:yss/*0:11*/); accum _/*0:01*/ (ys/*0:101*/:_/*0:11*/) = throw (bad_list_value ys/*0:101*/); accum _/*0:01*/ yss/*0:1*/ = throw (bad_list_value yss/*0:1*/) { @@ -884,14 +1094,302 @@ <var> state 4 state 4: #0 #1 } end; -zip (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = (x/*0:0101*/,y/*0:101*/):zip xs/*0:011*/ ys/*0:11*/; -zip _/*0:01*/ _/*0:1*/ = []; -zip3 (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = (x/*0:00101*/,y/*0:0101*/,z/*0:101*/):zip3 xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; -zip3 _/*0:001*/ _/*0:01*/ _/*0:1*/ = []; -zipwith f/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = f/*0:001*/ x/*0:0101*/ y/*0:101*/:zipwith f/*0:001*/ xs/*0:011*/ ys/*0:11*/; -zipwith f/*0:001*/ _/*0:01*/ _/*0:1*/ = []; -zipwith3 f/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = f/*0:0001*/ x/*0:00101*/ y/*0:0101*/ z/*0:101*/:zipwith3 f/*0:0001*/ xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; -zipwith3 f/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = []; +zip xs/*0:01*/ ys/*0:1*/ = accum/*0*/ [] xs/*0:01*/ ys/*0:1*/ with accum us/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = accum/*1*/ ((x/*0:0101*/,y/*0:101*/):us/*0:001*/) xs/*0:011*/ ys/*0:11*/; accum us/*0:001*/ _/*0:01*/ _/*0:1*/ = reverse us/*0:001*/ { + rule #0: accum us (x:xs) (y:ys) = accum ((x,y):us) xs ys + rule #1: accum us _ _ = reverse us + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + <app> state 4 + state 2: #1 + <var> state 3 + state 3: #1 + state 4: #0 #1 + <var> state 5 + <app> state 8 + state 5: #1 + <var> state 6 + state 6: #1 + <var> state 7 + state 7: #1 + state 8: #0 #1 + <var> state 9 + : state 13 + state 9: #1 + <var> state 10 + state 10: #1 + <var> state 11 + state 11: #1 + <var> state 12 + state 12: #1 + state 13: #0 #1 + <var> state 14 + state 14: #0 #1 + <var> state 15 + state 15: #0 #1 + <var> state 16 + <app> state 17 + state 16: #1 + state 17: #0 #1 + <var> state 18 + <app> state 20 + state 18: #1 + <var> state 19 + state 19: #1 + state 20: #0 #1 + <var> state 21 + : state 24 + state 21: #1 + <var> state 22 + state 22: #1 + <var> state 23 + state 23: #1 + state 24: #0 #1 + <var> state 25 + state 25: #0 #1 + <var> state 26 + state 26: #0 #1 +} end; +zip3 xs/*0:001*/ ys/*0:01*/ zs/*0:1*/ = accum/*0*/ [] xs/*0:001*/ ys/*0:01*/ zs/*0:1*/ with accum us/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = accum/*1*/ ((x/*0:00101*/,y/*0:0101*/,z/*0:101*/):us/*0:0001*/) xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; accum us/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = reverse us/*0:0001*/ { + rule #0: accum us (x:xs) (y:ys) (z:zs) = accum ((x,y,z):us) xs ys zs + rule #1: accum us _ _ _ = reverse us + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + <app> state 5 + state 2: #1 + <var> state 3 + state 3: #1 + <var> state 4 + state 4: #1 + state 5: #0 #1 + <var> state 6 + <app> state 10 + state 6: #1 + <var> state 7 + state 7: #1 + <var> state 8 + state 8: #1 + <var> state 9 + state 9: #1 + state 10: #0 #1 + <var> state 11 + : state 16 + state 11: #1 + <var> state 12 + state 12: #1 + <var> state 13 + state 13: #1 + <var> state 14 + state 14: #1 + <var> state 15 + state 15: #1 + state 16: #0 #1 + <var> state 17 + state 17: #0 #1 + <var> state 18 + state 18: #0 #1 + <var> state 19 + <app> state 21 + state 19: #1 + <var> state 20 + state 20: #1 + state 21: #0 #1 + <var> state 22 + <app> state 25 + state 22: #1 + <var> state 23 + state 23: #1 + <var> state 24 + state 24: #1 + state 25: #0 #1 + <var> state 26 + : state 30 + state 26: #1 + <var> state 27 + state 27: #1 + <var> state 28 + state 28: #1 + <var> state 29 + state 29: #1 + state 30: #0 #1 + <var> state 31 + state 31: #0 #1 + <var> state 32 + state 32: #0 #1 + <var> state 33 + <app> state 34 + state 33: #1 + state 34: #0 #1 + <var> state 35 + <app> state 37 + state 35: #1 + <var> state 36 + state 36: #1 + state 37: #0 #1 + <var> state 38 + : state 41 + state 38: #1 + <var> state 39 + state 39: #1 + <var> state 40 + state 40: #1 + state 41: #0 #1 + <var> state 42 + state 42: #0 #1 + <var> state 43 + state 43: #0 #1 +} end; +zipwith f/*0:001*/ xs/*0:01*/ ys/*0:1*/ = accum/*0*/ [] xs/*0:01*/ ys/*0:1*/ with accum us/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = accum/*1*/ (f/*1:001*/ x/*0:0101*/ y/*0:101*/:us/*0:001*/) xs/*0:011*/ ys/*0:11*/; accum us/*0:001*/ _/*0:01*/ _/*0:1*/ = reverse us/*0:001*/ { + rule #0: accum us (x:xs) (y:ys) = accum (f x y:us) xs ys + rule #1: accum us _ _ = reverse us + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + <app> state 4 + state 2: #1 + <var> state 3 + state 3: #1 + state 4: #0 #1 + <var> state 5 + <app> state 8 + state 5: #1 + <var> state 6 + state 6: #1 + <var> state 7 + state 7: #1 + state 8: #0 #1 + <var> state 9 + : state 13 + state 9: #1 + <var> state 10 + state 10: #1 + <var> state 11 + state 11: #1 + <var> state 12 + state 12: #1 + state 13: #0 #1 + <var> state 14 + state 14: #0 #1 + <var> state 15 + state 15: #0 #1 + <var> state 16 + <app> state 17 + state 16: #1 + state 17: #0 #1 + <var> state 18 + <app> state 20 + state 18: #1 + <var> state 19 + state 19: #1 + state 20: #0 #1 + <var> state 21 + : state 24 + state 21: #1 + <var> state 22 + state 22: #1 + <var> state 23 + state 23: #1 + state 24: #0 #1 + <var> state 25 + state 25: #0 #1 + <var> state 26 + state 26: #0 #1 +} end; +zipwith3 f/*0:0001*/ xs/*0:001*/ ys/*0:01*/ zs/*0:1*/ = accum/*0*/ [] xs/*0:001*/ ys/*0:01*/ zs/*0:1*/ with accum us/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = accum/*1*/ (f/*1:0001*/ x/*0:00101*/ y/*0:0101*/ z/*0:101*/:us/*0:0001*/) xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; accum us/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = reverse us/*0:0001*/ { + rule #0: accum us (x:xs) (y:ys) (z:zs) = accum (f x y z:us) xs ys zs + rule #1: accum us _ _ _ = reverse us + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + <app> state 5 + state 2: #1 + <var> state 3 + state 3: #1 + <var> state 4 + state 4: #1 + state 5: #0 #1 + <var> state 6 + <app> state 10 + state 6: #1 + <var> state 7 + state 7: #1 + <var> state 8 + state 8: #1 + <var> state 9 + state 9: #1 + state 10: #0 #1 + <var> state 11 + : state 16 + state 11: #1 + <var> state 12 + state 12: #1 + <var> state 13 + state 13: #1 + <var> state 14 + state 14: #1 + <var> state 15 + state 15: #1 + state 16: #0 #1 + <var> state 17 + state 17: #0 #1 + <var> state 18 + state 18: #0 #1 + <var> state 19 + <app> state 21 + state 19: #1 + <var> state 20 + state 20: #1 + state 21: #0 #1 + <var> state 22 + <app> state 25 + state 22: #1 + <var> state 23 + state 23: #1 + <var> state 24 + state 24: #1 + state 25: #0 #1 + <var> state 26 + : state 30 + state 26: #1 + <var> state 27 + state 27: #1 + <var> state 28 + state 28: #1 + <var> state 29 + state 29: #1 + state 30: #0 #1 + <var> state 31 + state 31: #0 #1 + <var> state 32 + state 32: #0 #1 + <var> state 33 + <app> state 34 + state 33: #1 + state 34: #0 #1 + <var> state 35 + <app> state 37 + state 35: #1 + <var> state 36 + state 36: #1 + state 37: #0 #1 + <var> state 38 + : state 41 + state 38: #1 + <var> state 39 + state 39: #1 + <var> state 40 + state 40: #1 + state 41: #0 #1 + <var> state 42 + state 42: #0 #1 + <var> state 43 + state 43: #0 #1 +} end; dowith f/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = dowith f/*1:001*/ xs/*1:011*/ ys/*1:11*/ when _/*0:*/ = f/*0:001*/ x/*0:0101*/ y/*0:101*/ { rule #0: _ = f x y state 0: #0 @@ -906,8 +1404,9 @@ state 1: #0 } end; dowith3 f/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = (); -unzip ((x/*0:10101*/,y/*0:1011*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:1011*/:ys/*0:1*/ when xs/*0:01*/,ys/*0:1*/ = unzip us/*0:11*/ { - rule #0: xs,ys = unzip us +unzip [] = [],[]; +unzip ((x/*0:10101*/,y/*0:1011*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:1011*/:ys/*0:1*/ when xs/*0:01*/,ys/*0:1*/ = accum/*0*/ [] [] us/*0:11*/ { + rule #0: xs,ys = accum [] [] us state 0: #0 <app> state 1 state 1: #0 @@ -919,10 +1418,69 @@ state 4: #0 <var> state 5 state 5: #0 +} end with accum xs/*0:001*/ ys/*0:01*/ [] = reverse xs/*0:001*/,reverse ys/*0:01*/; accum xs/*0:001*/ ys/*0:01*/ ((x/*0:10101*/,y/*0:1011*/):us/*0:11*/) = accum/*1*/ (x/*0:10101*/:xs/*0:001*/) (y/*0:1011*/:ys/*0:01*/) us/*0:11*/; accum _/*0:001*/ _/*0:01*/ us/*0:1*/ = throw (bad_list_value us/*0:1*/) { + rule #0: accum xs ys [] = reverse xs,reverse ys + rule #1: accum xs ys ((x,y):us) = accum (x:xs) (y:ys) us + rule #2: accum _ _ us = throw (bad_list_value us) + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + state 2: #0 #1 #2 + <var> state 3 + [] state 4 + <app> state 5 + state 3: #2 + state 4: #0 #2 + state 5: #1 #2 + <var> state 6 + <app> state 8 + state 6: #2 + <var> state 7 + state 7: #2 + state 8: #1 #2 + <var> state 9 + : state 12 + state 9: #2 + <var> state 10 + state 10: #2 + <var> state 11 + state 11: #2 + state 12: #1 #2 + <var> state 13 + <app> state 15 + state 13: #2 + <var> state 14 + state 14: #2 + state 15: #1 #2 + <var> state 16 + <app> state 19 + state 16: #2 + <var> state 17 + state 17: #2 + <var> state 18 + state 18: #2 + state 19: #1 #2 + <var> state 20 + , state 24 + state 20: #2 + <var> state 21 + state 21: #2 + <var> state 22 + state 22: #2 + <var> state 23 + state 23: #2 + state 24: #1 #2 + <var> state 25 + state 25: #1 #2 + <var> state 26 + state 26: #1 #2 + <var> state 27 + state 27: #1 #2 } end; -unzip [] = [],[]; -unzip3 ((x/*0:10101*/,y/*0:101101*/,z/*0:10111*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:101101*/:ys/*0:101*/,z/*1:10111*/:zs/*0:11*/ when xs/*0:01*/,ys/*0:101*/,zs/*0:11*/ = unzip3 us/*0:11*/ { - rule #0: xs,ys,zs = unzip3 us +unzip3 [] = [],[],[]; +unzip3 ((x/*0:10101*/,y/*0:101101*/,z/*0:10111*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:101101*/:ys/*0:101*/,z/*1:10111*/:zs/*0:11*/ when xs/*0:01*/,ys/*0:101*/,zs/*0:11*/ = accum/*0*/ [] [] [] us/*0:11*/ { + rule #0: xs,ys,zs = accum [] [] [] us state 0: #0 <app> state 1 state 1: #0 @@ -942,5 +1500,91 @@ state 8: #0 <var> state 9 state 9: #0 +} end with accum xs/*0:0001*/ ys/*0:001*/ zs/*0:01*/ [] = reverse xs/*0:0001*/,reverse ys/*0:001*/,reverse zs/*0:01*/; accum xs/*0:0001*/ ys/*0:001*/ zs/*0:01*/ ((x/*0:10101*/,y/*0:101101*/,z/*0:10111*/):us/*0:11*/) = accum/*1*/ (x/*0:10101*/:xs/*0:0001*/) (y/*0:101101*/:ys/*0:001*/) (z/*0:10111*/:zs/*0:01*/) us/*0:11*/; accum _/*0:0001*/ _/*0:001*/ _/*0:01*/ us/*0:1*/ = throw (bad_list_value us/*0:1*/) { + rule #0: accum xs ys zs [] = reverse xs,reverse ys,reverse zs + rule #1: accum xs ys zs ((x,y,z):us) = accum (x:xs) (y:ys) (z:zs) us + rule #2: accum _ _ _ us = throw (bad_list_value us) + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + state 2: #0 #1 #2 + <var> state 3 + state 3: #0 #1 #2 + <var> state 4 + [] state 5 + <app> state 6 + state 4: #2 + state 5: #0 #2 + state 6: #1 #2 + <var> state 7 + <app> state 9 + state 7: #2 + <var> state 8 + state 8: #2 + state 9: #1 #2 + <var> state 10 + : state 13 + state 10: #2 + <var> state 11 + state 11: #2 + <var> state 12 + state 12: #2 + state 13: #1 #2 + <var> state 14 + <app> state 16 + state 14: #2 + <var> state 15 + state 15: #2 + state 16: #1 #2 + <var> state 17 + <app> state 20 + state 17: #2 + <var> state 18 + state 18: #2 + <var> state 19 + state 19: #2 + state 20: #1 #2 + <var> state 21 + , state 25 + state 21: #2 + <var> state 22 + state 22: #2 + <var> state 23 + state 23: #2 + <var> state 24 + state 24: #2 + state 25: #1 #2 + <var> state 26 + state 26: #1 #2 + <var> state 27 + <app> state 29 + state 27: #2 + <var> state 28 + state 28: #2 + state 29: #1 #2 + <var> state 30 + <app> state 33 + state 30: #2 + <var> state 31 + state 31: #2 + <var> state 32 + state 32: #2 + state 33: #1 #2 + <var> state 34 + , state 38 + state 34: #2 + <var> state 35 + state 35: #2 + <var> state 36 + state 36: #2 + <var> state 37 + state 37: #2 + state 38: #1 #2 + <var> state 39 + state 39: #1 #2 + <var> state 40 + state 40: #1 #2 + <var> state 41 + state 41: #1 #2 } end; -unzip3 [] = [],[],[]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-27 19:18:03
|
Revision: 146 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=146&view=rev Author: agraef Date: 2008-05-27 12:17:52 -0700 (Tue, 27 May 2008) Log Message: ----------- Get rid of silly empty_list exceptions. Modified Paths: -------------- pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-27 18:13:58 UTC (rev 145) +++ pure/trunk/lib/prelude.pure 2008-05-27 19:17:52 UTC (rev 146) @@ -35,7 +35,6 @@ need to work from the end of a list towards its front. */ nullary out_of_bounds; // tuple or list index is out of bounds (!) -nullary empty_list; // empty list (head, tail, etc.) // bad_list_value xs; // not a proper list value (reverse, etc.) // xs denotes the offending tail of the list @@ -256,7 +255,6 @@ foldr1 f (x:xs) = foldr f x xs; head (x:xs) = x; -head [] = throw empty_list; init [x] = []; init (x:xs) = accum [x] xs with @@ -264,11 +262,9 @@ accum ys (x:xs) = accum (x:ys) xs; accum ys xs = reverse ys+init xs; end; -init [] = throw empty_list; last [x] = x; last (x:xs) = last xs; -last [] = throw empty_list; map f [] = []; map f (x:xs) = accum [f x] xs with @@ -307,7 +303,6 @@ end; tail (x:xs) = xs; -tail [] = throw empty_list; take n::int [] = []; take n::int (x:xs) Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-27 18:13:58 UTC (rev 145) +++ pure/trunk/test/prelude.log 2008-05-27 19:17:52 UTC (rev 146) @@ -708,7 +708,6 @@ foldr1 f/*0:01*/ [x/*0:101*/] = x/*0:101*/; foldr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldr f/*0:01*/ x/*0:101*/ xs/*0:11*/; head (x/*0:101*/:xs/*0:11*/) = x/*0:101*/; -head [] = throw empty_list; init [x/*0:101*/] = []; init (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [x/*0:101*/] xs/*0:11*/ with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+init xs/*0:1*/ { rule #0: accum ys [] = reverse ys @@ -742,10 +741,8 @@ <var> state 13 state 13: #1 #2 } end; -init [] = throw empty_list; last [x/*0:101*/] = x/*0:101*/; last (x/*0:101*/:xs/*0:11*/) = last xs/*0:11*/; -last [] = throw empty_list; map f/*0:01*/ [] = []; map f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [f/*0:01*/ x/*0:101*/] xs/*0:11*/ with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (f/*1:01*/ x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+map f/*1:01*/ xs/*0:1*/ { rule #0: accum ys [] = reverse ys @@ -891,7 +888,6 @@ state 1: #0 } end; tail (x/*0:101*/:xs/*0:11*/) = xs/*0:11*/; -tail [] = throw empty_list; take n/*0:01*/::int [] = []; take n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = accum/*0*/ n/*0:01*/ [] (x/*0:101*/:xs/*0:11*/) with accum _/*0:001*/ ys/*0:01*/ [] = reverse ys/*0:01*/; accum n/*0:001*/::int ys/*0:01*/ _/*0:1*/ = reverse ys/*0:01*/ if n/*0:001*/<=0; accum n/*0:001*/::int ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (n/*0:001*/-1) (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum n/*0:001*/ ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+take n/*0:001*/ xs/*0:1*/ { rule #0: accum _ ys [] = reverse ys This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-28 03:40:47
|
Revision: 147 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=147&view=rev Author: agraef Date: 2008-05-27 20:40:55 -0700 (Tue, 27 May 2008) Log Message: ----------- Overhaul of prelude. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lib/prelude.pure pure/trunk/lib/strings.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-27 19:17:52 UTC (rev 146) +++ pure/trunk/ChangeLog 2008-05-28 03:40:55 UTC (rev 147) @@ -1,3 +1,11 @@ +2008-05-28 Albert Graef <Dr....@t-...> + + * lib/strings.pure: Make 'cycle' work on strings. Reported by + Eddie Rucker. + + * lib/prelude.pure: Make 'index' work on lists. Code contributed + by Eddie Rucker. + 2008-05-27 Albert Graef <Dr....@t-...> * lib/prelude.pure: Rewrite prelude operations to make them Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-27 19:17:52 UTC (rev 146) +++ pure/trunk/lib/prelude.pure 2008-05-28 03:40:55 UTC (rev 147) @@ -339,6 +339,17 @@ catmap f xs = cat (map f xs); +/* Search an element in a list. Returns -1 if not found, index of first + occurrence otherwise. */ + +index [] _ = -1; +index (x:xs) y = search 0 (x:xs) with + search _ [] = -1; + search n::int (x:xs) = n if x==y; + = search (n+1) xs; + search _ xs = index xs y; +end; + /* Some useful list generators. */ repeat n::int x = accum [] n x with @@ -349,11 +360,10 @@ cycle n::int [] = []; cycle n::int (x:xs) = [] if n<=0; - = accum [] (#xs) n xs with - accum ys m::int n::int xs - = cat ys+take n xs if n<=m; - = accum (xs:ys) m (n-m) xs otherwise; - end when xs = x:xs end; + = accum [] n with + accum ys n::int = cat ys+take n xs if n<=m; + = accum (xs:ys) (n-m) otherwise; + end when xs = x:xs; m::int = #xs end if listp xs; while p f a = accum [] p f a with accum as p f a = accum (a:as) p f (f a) if p a; @@ -367,44 +377,43 @@ /* zip, unzip and friends. */ -zip xs ys = accum [] xs ys with +zip xs ys = accum [] xs ys with accum us (x:xs) (y:ys) = accum ((x,y):us) xs ys; accum us _ _ = reverse us; end; -zip3 xs ys zs = accum [] xs ys zs with +zip3 xs ys zs = accum [] xs ys zs with accum us (x:xs) (y:ys) (z:zs) = accum ((x,y,z):us) xs ys zs; accum us _ _ _ = reverse us; end; -zipwith f xs ys = accum [] xs ys with +zipwith f xs ys = accum [] xs ys with accum us (x:xs) (y:ys) = accum (f x y:us) xs ys; accum us _ _ = reverse us; end; -zipwith3 f xs ys zs = accum [] xs ys zs with +zipwith3 f xs ys zs = accum [] xs ys zs with accum us (x:xs) (y:ys) (z:zs) = accum (f x y z:us) xs ys zs; accum us _ _ _ = reverse us; end; -dowith f (x:xs) (y:ys) - = dowith f xs ys when _ = f x y end; -dowith f _ _ = () otherwise; +dowith f (x:xs) (y:ys) = dowith f xs ys when _ = f x y end; +dowith f _ _ = () otherwise; dowith3 f (x:xs) (y:ys) (z:zs) - = dowith3 f xs ys zs when _ = f x y z end; -dowith3 f _ _ _ = () otherwise; + = dowith3 f xs ys zs when _ = f x y z end; +dowith3 f _ _ _ = () otherwise; -unzip [] = [],[]; -unzip ((x,y):us) = x:xs,y:ys when xs,ys = accum [] [] us end +unzip [] = [],[]; +unzip ((x,y):us) = x:xs,y:ys when xs,ys = accum [] [] us end with accum xs ys [] = reverse xs,reverse ys; accum xs ys ((x,y):us) = accum (x:xs) (y:ys) us; accum _ _ us = throw (bad_list_value us); end; -unzip3 [] = [],[],[]; -unzip3 ((x,y,z):us) = x:xs,y:ys,z:zs when xs,ys,zs = accum [] [] [] us end +unzip3 [] = [],[],[]; +unzip3 ((x,y,z):us) = x:xs,y:ys,z:zs when xs,ys,zs = accum [] [] [] us end with accum xs ys zs [] = reverse xs,reverse ys,reverse zs; accum xs ys zs ((x,y,z):us) = accum (x:xs) (y:ys) (z:zs) us; Modified: pure/trunk/lib/strings.pure =================================================================== --- pure/trunk/lib/strings.pure 2008-05-27 19:17:52 UTC (rev 146) +++ pure/trunk/lib/strings.pure 2008-05-28 03:40:55 UTC (rev 147) @@ -143,6 +143,13 @@ reverse s::string = strcat (reverse (chars s)); cat (s::string:xs) = cat (chars s:xs); +cycle n::int "" = ""; +cycle n::int s::string = "" if n<=0; + = accum [] n with + accum ys n = strcat ys+take n s if n<=m; + = accum (s:ys) (n-m) otherwise; + end when m::int = #s end; + all p s::string = all p (chars s); any p s::string = any p (chars s); do f s::string = do f (chars s); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-28 03:56:09
|
Revision: 150 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=150&view=rev Author: agraef Date: 2008-05-27 20:56:18 -0700 (Tue, 27 May 2008) Log Message: ----------- Overhaul of prelude. Modified Paths: -------------- pure/trunk/lib/strings.pure pure/trunk/test/prelude.log Modified: pure/trunk/lib/strings.pure =================================================================== --- pure/trunk/lib/strings.pure 2008-05-28 03:55:48 UTC (rev 149) +++ pure/trunk/lib/strings.pure 2008-05-28 03:56:18 UTC (rev 150) @@ -140,6 +140,9 @@ /* Define the customary list operations on strings, so that these can mostly be used as if they were lists. */ +list s::string = chars s; +tuple s::string = tuple (chars s); + reverse s::string = strcat (reverse (chars s)); cat (s::string:xs) = cat (chars s:xs); Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-28 03:55:48 UTC (rev 149) +++ pure/trunk/test/prelude.log 2008-05-28 03:56:18 UTC (rev 150) @@ -293,6 +293,8 @@ <var> state 1 state 1: #0 } end if not null delim/*0:01*/; +list s/*0:1*/::string = chars s/*0:1*/; +tuple s/*0:1*/::string = tuple (chars s/*0:1*/); reverse s/*0:1*/::string = strcat (reverse (chars s/*0:1*/)); cat (s/*0:101*/::string:xs/*0:11*/) = cat (chars s/*0:101*/:xs/*0:11*/); cycle n/*0:01*/::int "" = ""; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-28 05:50:28
|
Revision: 152 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=152&view=rev Author: agraef Date: 2008-05-27 22:50:36 -0700 (Tue, 27 May 2008) Log Message: ----------- Optimization pure_freenew calls. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/runtime.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-28 04:58:13 UTC (rev 151) +++ pure/trunk/ChangeLog 2008-05-28 05:50:36 UTC (rev 152) @@ -1,5 +1,7 @@ 2008-05-28 Albert Graef <Dr....@t-...> + * interpreter.cc, runtime.cc: Optimization pure_freenew calls. + * lib/strings.pure: Make 'cycle' work on strings. Reported by Eddie Rucker. Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-28 04:58:13 UTC (rev 151) +++ pure/trunk/interpreter.cc 2008-05-28 05:50:36 UTC (rev 152) @@ -2823,8 +2823,10 @@ Value *u = codegen(x); Value *p = e.builder.CreateBitCast(u, IntExprPtrTy, "intexpr"); Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "intval"); +#if 0 // collect the temporary, it's not needed any more call("pure_freenew", u); +#endif return v; } else { // double variable, needs unboxing and int conversion @@ -2833,8 +2835,10 @@ Value *p = e.builder.CreateBitCast(u, DblExprPtrTy, "dblexpr"); Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "dblval"); v = e.builder.CreateFPToSI(v, Type::Int32Ty); +#if 0 // collect the temporary, it's not needed any more call("pure_freenew", u); +#endif return v; } } else { @@ -2876,8 +2880,10 @@ Value *p = e.builder.CreateBitCast(u, IntExprPtrTy, "intexpr"); Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "intval"); v = e.builder.CreateSIToFP(v, Type::DoubleTy); +#if 0 // collect the temporary, it's not needed any more call("pure_freenew", u); +#endif return v; } else { // double variable, needs unboxing @@ -2885,8 +2891,10 @@ Value *u = codegen(x); Value *p = e.builder.CreateBitCast(u, DblExprPtrTy, "dblexpr"); Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "dblval"); +#if 0 // collect the temporary, it's not needed any more call("pure_freenew", u); +#endif return v; } } else { Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-05-28 04:58:13 UTC (rev 151) +++ pure/trunk/runtime.cc 2008-05-28 05:50:36 UTC (rev 152) @@ -806,7 +806,8 @@ extern "C" void pure_freenew(pure_expr *x) { - pure_free_internal(pure_new_internal(x)); + if (x->refc == 0) + pure_free_internal(pure_new_internal(x)); } extern "C" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-28 06:30:21
|
Revision: 156 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=156&view=rev Author: agraef Date: 2008-05-27 23:30:29 -0700 (Tue, 27 May 2008) Log Message: ----------- Update keyword table. Modified Paths: -------------- pure/trunk/pure.vim pure/trunk/pure.xml Modified: pure/trunk/pure.vim =================================================================== --- pure/trunk/pure.vim 2008-05-28 06:10:33 UTC (rev 155) +++ pure/trunk/pure.vim 2008-05-28 06:30:29 UTC (rev 156) @@ -35,7 +35,8 @@ syn keyword pureKeyword infix infixl infixr prefix postfix nullary syn keyword pureKeyword case else end extern if let of otherwise then syn keyword pureKeyword using when with -syn keyword pureIdentifier bigint bool char double expr int string pointer void +syn keyword pureIdentifier bigint bool char short int long double +syn keyword pureIdentifier expr string pointer void syn match pureNumber "\<[0-9]*\>" syn match pureHexNumber "\<0[Xx][0-9A-Fa-f]*\>" Modified: pure/trunk/pure.xml =================================================================== --- pure/trunk/pure.xml 2008-05-28 06:10:33 UTC (rev 155) +++ pure/trunk/pure.xml 2008-05-28 06:30:29 UTC (rev 156) @@ -28,7 +28,9 @@ <item> char </item> <item> double </item> <item> expr </item> + <item> short </item> <item> int </item> + <item> long </item> <item> string </item> <item> pointer </item> <item> void </item> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-01 18:24:50
|
Revision: 158 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=158&view=rev Author: agraef Date: 2008-06-01 11:24:53 -0700 (Sun, 01 Jun 2008) Log Message: ----------- Put runtime and interpreter into a shared library. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/INSTALL pure/trunk/Makefile pure/trunk/interpreter.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-28 07:52:52 UTC (rev 157) +++ pure/trunk/ChangeLog 2008-06-01 18:24:53 UTC (rev 158) @@ -1,3 +1,12 @@ +2008-06-01 Albert Graef <Dr....@t-...> + + * Makefile, interpreter.cc: Put the runtime and interpreter into a + separate shared library, to make it possible for modules to link + against the runtime, and to reduce the memory footprint when + multiple instances of the interpreter are run as different + processes. Also, this makes it possible to access the runtime + routines on systems where a program cannot dlopen itself. + 2008-05-28 Albert Graef <Dr....@t-...> * interpreter.cc, runtime.cc: Optimization pure_freenew calls. Modified: pure/trunk/INSTALL =================================================================== --- pure/trunk/INSTALL 2008-05-28 07:52:52 UTC (rev 157) +++ pure/trunk/INSTALL 2008-06-01 18:24:53 UTC (rev 158) @@ -4,11 +4,11 @@ These instructions (mostly by courtesy of Eddie Rucker, thanks Eddie!) explain how to compile and install LLVM (which is the compiler backend required by -Pure) and the Pure interpreter itself. More information about installing LLVM -and the required LLVM source packages can be found at http://llvm.org. Please -also have a look at the SYSTEM NOTES section at the end of this file which -describes the tweaks necessary to make Pure compile and run on various -platforms. +Pure) and the Pure interpreter itself. The instructions are for Linux and +similar Unix-like systems; the SYSTEM NOTES section at the end of this file +details the tweaks necessary to make Pure compile and run on various other +platforms. More information about installing LLVM and the required LLVM source +packages can be found at http://llvm.org. Pure is known to work on Linux and Mac OSX, but should compile (with the usual amount of tweaking) on all UNIX/POSIX-based platforms. We recommend using @@ -57,12 +57,15 @@ STEP 3. Configure, build and install LLVM as follows: $ cd llvm-2.2 -$ ./configure +$ ./configure --enable-optimized --disable-assertions --disable-expensive-checks --enable-targets=host-only $ make ENABLE_OPTIMIZED=1 $ sudo make install -(To do a debug build of LLVM, leave away the 'ENABLE_OPTIMIZED=1' parameter. -Note, however, that this will considerably slow down the Pure compiler.) +Note the configure flags; these are for an optimized (non-debug) build and +disable all compilation targets except the one for your system. To do a debug +build of LLVM, simply leave away all the extra configure parameters (except +possibly --enable-targets=host-only). Note, however, that this will +considerably slow down the Pure compiler. STEP 4. Get and unpack the Pure sources at: http://pure-lang.sf.net/ @@ -76,9 +79,12 @@ $ cd pure-x.y $ make $ sudo make install +$ sudo /sbin/ldconfig -Note that compiling Pure with optimizations enabled (this is the default) may -take quite a while, so please have some patience. +(The latter step is required on Linux systems to tell the dynamic linker to +update its cache so that it finds the Pure runtime library, libpure-x.y.so. +On other systems it may be sufficient to install the library in a location +which is searched by the dynamic linker.) After the build is complete, you can check that Pure is working correctly on your computer, as follows: @@ -138,35 +144,42 @@ $ cd pure-lang/pure/trunk $ make $ sudo make install +$ sudo /sbin/ldconfig OTHER COMPILATION OPTIONS ===== =========== ======= -By default, the pure program is installed under /usr/local/bin, with the -library files going into /usr/local/lib/pure. The installation directory can -be changed by editing the definition of the 'prefix' variable in the Makefile, -or by specifying the desired value on the 'make' command line, e.g.: +By default, the pure program is installed under /usr/local/bin, the +libpure-x.y.so library under /usr/local/lib, and the library scripts under +/usr/local/lib/pure. The installation directory can be changed by editing the +definition of the 'prefix' variable in the Makefile, or by specifying the +desired value on the 'make' command line, e.g.: $ make all install prefix=/usr Note that you should specify this option *both* at compile and installation time since certain default paths are hardcoded into the interpreter (but can be changed at runtime by setting corresponding environment variables, see the -manpage for details). +manpage for details). Also note that if you install Pure into a non-standard +location, you may have to set the LD_LIBRARY_PATH variable so that the dynamic +linker finds the Pure runtime library, libpure-x.y.so. After your build is done, you can (and should) also run 'make check' to verify that your Pure interpreter works correctly. This can be done without installing the software. In fact, there's no need to install the interpreter if you just want to take it for a test drive, you can simply run it from the -source directory. Just make sure that you set the PURELIB environment variable -to the lib directory in the sources which holds the prelude and the other -library scripts. The following command, +source directory, if you set up the following environment variables: -$ PURELIB=./lib ./pure +- LD_LIBRARY_PATH=. This is required on Linux systems so that libpure-x.y.so + is found. Other systems may require an analogous setting, or none at all. -will run the Pure interpreter with that setting in Bourne-compatible shells. +- PURELIB=./lib This is required on all systems so that the interpreter finds + the prelude and other library scripts. +After that you should be able to run the Pure interpreter from the source +directory, by typing './pure'. + There are a number of other variables you can set on the 'make' command line if you need special compiler (CXXFLAGS) or linker flags (LDFLAGS), or if you have to add platform-specific libraries (LIBS). Please see the Makefile for @@ -188,6 +201,10 @@ 4.1, YMMV), so you are encouraged to use the 'default' build unless performance is really critical. +To get smaller executables with either the default or the release build, add +'LDFLAGS=-s' to the 'make' command (gcc only, other compilers may provide a +similar flag to strip compiled executables and libraries). + You can also do a 'debug' build as follows: $ make build=debug @@ -241,20 +258,18 @@ ----- Linux is the primary development platform for this software, and the sources -should build out of the box on all recent Linux distributions. However, note -the issues on 64 bit Linux systems described above. +should build out of the box on all recent Linux distributions. MAC OSX --- --- A port by Ryan Schmidt exists in the MacPorts collection at http://www.macports.org/. If you compile Pure from the original sources -yourself, you should remove the -rdynamic option from the link line (it's not -needed on OSX) and add the -liconv flag instead. To these ends, build Pure -with the following make command (add the build=release option for the release -build): +yourself, you should add the -liconv flag to the link line. To these ends, +build Pure with the following make command (add the build=release option for +the release build): -$ make LDFLAGS="" LIBS="-liconv" +$ make LIBS="-liconv" Also note that with at least some current versions of the Apple gcc compiler (4.0.1 and similar) you'll get the (bogus) warning "control reaches end of @@ -266,12 +281,12 @@ MS WINDOWS -- ------- -Nobody has reported a successful port to this platform yet, but it should be -rather straightforward (albeit arduous) to do this with either Cygwin -(http://www.cygwin.com/) or Mingw (http://www.mingw.org/), once you have all -the necessary dependencies and a suitable version of LLVM installed. So *you* -can still be the hero who first got Pure up and running on Windows; if you do, -please let us know! :) +Jiri Spitz is currently working on a Windows port using Mingw. Once this is +finished, we'll provide Windows installation instructions here. For the time +being, you can try for yourself; porting should be rather straightforward with +either Cygwin (http://www.cygwin.com/) or Mingw (http://www.mingw.org/), once +you have all the necessary dependencies and a suitable version of LLVM +installed. May 2008 Modified: pure/trunk/Makefile =================================================================== --- pure/trunk/Makefile 2008-05-28 07:52:52 UTC (rev 157) +++ pure/trunk/Makefile 2008-06-01 18:24:53 UTC (rev 158) @@ -14,9 +14,19 @@ prefix = /usr/local bindir = $(prefix)/bin -libdir = $(prefix)/lib/pure +libdir = $(prefix)/lib mandir = $(prefix)/share/man/man1 +# Pure library name. Currently we use a simple versioning scheme, which +# requires that the library version matches that of the interpreter. With some +# extra fiddling, this enables you to install different versions of the Pure +# interpreter on the same system. + +# NOTE: You might have to change the suffix .so for your system (e.g., use +# .dll on Windows). + +libpure = libpure-$(version).so + # Staging directory for 'make install'. If you use this, make sure that this # ends in a slash. @@ -25,12 +35,9 @@ # Linker flags. Adjust these as necessary for your system. # LDFLAGS is for additional linker options, LIBS for additional libraries that -# might be needed (e.g., -liconv on OSX). Note that the -rdynamic flag is -# required when using gcc with the ELF linker (e.g., Linux on x86) to enable -# the dlopening of the program executable. On OSX this option isn't needed -# (pass LDFLAGS="" to 'make' instead). +# might be needed (e.g., -liconv on OSX and Windows). -LDFLAGS=-rdynamic +LDFLAGS= LIBS= # Compilation flags. We currently provide the following build profiles: @@ -62,9 +69,6 @@ # installation or any other targets except 'all'.) Just 'make' builds with the # default flags. -# Note that both the 'default' and the 'release' build may take quite a while -# to compile (especially runtime.cc), so please be patient. ;-) - build=default LLVM_FLAGS = `llvm-config --cppflags` @@ -104,11 +108,11 @@ # No need to edit below this line. Unless you really have to. :) ############ SOURCE = expr.cc expr.hh funcall.h interpreter.cc interpreter.hh lexer.ll \ -matcher.cc matcher.hh parser.yy printer.cc printer.hh pure.cc \ +matcher.cc matcher.hh parser.yy printer.cc printer.hh \ runtime.cc runtime.h symtable.cc symtable.hh util.cc util.hh EXTRA_SOURCE = lexer.cc parser.cc parser.hh location.hh position.hh stack.hh OBJECT = $(subst .cc,.o,$(filter %.cc,$(SOURCE) $(EXTRA_SOURCE))) -ALL_LIBS = $(LLVM_LIBS) -lreadline -lgmp $(LIBS) +ALL_LIBS = -lreadline -lgmp $(LIBS) examples = $(wildcard examples/*.pure) lib = $(wildcard lib/*.pure) @@ -117,7 +121,7 @@ distlogs = $(wildcard test/*.log) DISTFILES = COPYING ChangeLog INSTALL NEWS README TODO Makefile \ -$(SOURCE) $(EXTRA_SOURCE) w3centities.c pure.1 pure.xml pure.vim \ +$(SOURCE) $(EXTRA_SOURCE) w3centities.c pure.cc pure.1 pure.xml pure.vim \ $(examples) $(lib) $(tests) $(distlogs) .PHONY: all html dvi ps pdf clean realclean depend install uninstall strip \ @@ -127,11 +131,14 @@ all: pure -pure: $(OBJECT) - $(CXX) -o $@ $(LDFLAGS) $(OBJECT) $(ALL_LIBS) +pure: pure.o $(libpure) + $(CXX) -o $@ $(LDFLAGS) pure.o -L. -lpure-$(version) $(ALL_LIBS) +$(libpure): $(OBJECT) + $(CXX) -shared -o $@ $(LDFLAGS) $(OBJECT) $(LLVM_LIBS) $(ALL_LIBS) + pure.o: pure.cc - $(CXX) $(CXXFLAGS) -DVERSION='"$(version)"' -DPURELIB='"$(libdir)"' -c -o $@ $< + $(CXX) $(CXXFLAGS) -DVERSION='"$(version)"' -DPURELIB='"$(libdir)/pure"' -c -o $@ $< lexer.cc: lexer.ll flex -o lexer.cc $< @@ -163,7 +170,7 @@ # cleaning clean: - rm -f *~ *.bak *.html *.dvi *.ps pure $(OBJECT) parser.output + rm -f *~ *.bak *.html *.dvi *.ps pure $(OBJECT) pure.o $(libpure) parser.output cleanlogs: rm -f $(logs) @@ -176,24 +183,17 @@ depend: $(SOURCE) $(EXTRA_SOURCE) makedepend -Y $(SOURCE) $(EXTRA_SOURCE) 2> /dev/null -# Strip symbols from the executable. You might want to run this on Linux -# systems before installation to get a smaller executable. *Never* do this on -# OSX though, as the symbols are needed to properly resolve the runtime -# externals which are linked into the executable. - -strip: pure - strip pure - # installation install: pure $(lib) - install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(mandir) + install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(mandir) install pure $(DESTDIR)$(bindir)/pure - install -m 644 $(lib) $(DESTDIR)$(libdir) + install $(libpure) $(DESTDIR)$(libdir)/$(libpure) + install -m 644 $(lib) $(DESTDIR)$(libdir)/pure install -m 644 pure.1 $(DESTDIR)$(mandir)/pure.1 uninstall: - rm -rf $(DESTDIR)$(bindir)/pure $(DESTDIR)$(libdir) $(DESTDIR)$(mandir)/pure.1 + rm -rf $(DESTDIR)$(bindir)/pure $(DESTDIR)$(libdir)/$(libpure) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(mandir)/pure.1 # roll a distribution tarball @@ -219,14 +219,14 @@ check: pure @ echo Running tests. - @ (export PURELIB=./lib; echo -n "prelude.pure: "; if ./pure -n -v$(level) lib/prelude.pure 2>&1 | diff -q - test/prelude.log > /dev/null; then echo passed; else echo FAILED; fi) - @ (cd test; export PURELIB=../lib; for x in $(tests); do f="`basename $$x`"; l="`basename $$x .pure`.log"; echo -n "$$x: "; if ../pure -v$(level) < $$f 2>&1 | diff -q - $$l > /dev/null; then echo passed; else echo FAILED; fi; done) + @ (export LD_LIBRARY_PATH=.; export PURELIB=./lib; echo -n "prelude.pure: "; if ./pure -n -v$(level) lib/prelude.pure 2>&1 | diff -q - test/prelude.log > /dev/null; then echo passed; else echo FAILED; fi) + @ (cd test; export LD_LIBRARY_PATH=..; export PURELIB=../lib; for x in $(tests); do f="`basename $$x`"; l="`basename $$x .pure`.log"; echo -n "$$x: "; if ../pure -v$(level) < $$f 2>&1 | diff -q - $$l > /dev/null; then echo passed; else echo FAILED; fi; done) test/prelude.log: lib/prelude.pure lib/primitives.pure lib/strings.pure - PURELIB=./lib ./pure -n -v$(level) $< > $@ 2>&1 + LD_LIBRARY_PATH=. PURELIB=./lib ./pure -n -v$(level) $< > $@ 2>&1 %.log: %.pure - PURELIB=./lib ./pure -v$(level) < $< > $@ 2>&1 + LD_LIBRARY_PATH=. PURELIB=./lib ./pure -v$(level) < $< > $@ 2>&1 # DO NOT DELETE Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-28 07:52:52 UTC (rev 157) +++ pure/trunk/interpreter.cc 2008-06-01 18:24:53 UTC (rev 158) @@ -61,6 +61,7 @@ if (!g_interp) { g_interp = this; stackdir = c_stack_dir(); + llvm::sys::DynamicLibrary::LoadLibraryPermanently("libpure", 0); } sstk_sz = 0; sstk_cap = 0x10000; // 64K This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-04 07:56:15
|
Revision: 168 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=168&view=rev Author: agraef Date: 2008-06-04 00:56:24 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Add options for various build types. Modified Paths: -------------- pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-04 07:55:18 UTC (rev 167) +++ pure/trunk/configure 2008-06-04 07:56:24 UTC (rev 168) @@ -1205,6 +1205,13 @@ esac cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-release enable the release build + --enable-debug enable the debug build + --enable-debug2 enable the maintenance build + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) @@ -2260,6 +2267,27 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Check whether --enable-release was given. +if test "${enable_release+set}" = set; then + enableval=$enable_release; case "${enableval}" in + yes) CXXFLAGS="-O3 -DNDEBUG -DDEBUG=0" ;; + esac +fi + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then + enableval=$enable_debug; case "${enableval}" in + yes) CXXFLAGS="-g" ;; + esac +fi + +# Check whether --enable-debug2 was given. +if test "${enable_debug2+set}" = set; then + enableval=$enable_debug2; case "${enableval}" in + yes) CXXFLAGS="-g -DDEBUG=2" ;; + esac +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-04 07:55:18 UTC (rev 167) +++ pure/trunk/configure.ac 2008-06-04 07:56:24 UTC (rev 168) @@ -2,6 +2,21 @@ AC_INIT(pure, 0.3) AC_CONFIG_HEADERS(config.h) AC_PROG_CXX +AC_ARG_ENABLE(release, + [ --enable-release enable the release build], + [case "${enableval}" in + yes) CXXFLAGS="-O3 -DNDEBUG -DDEBUG=0" ;; + esac]) +AC_ARG_ENABLE(debug, + [ --enable-debug enable the debug build], + [case "${enableval}" in + yes) CXXFLAGS="-g" ;; + esac]) +AC_ARG_ENABLE(debug2, + [ --enable-debug2 enable the maintenance build], + [case "${enableval}" in + yes) CXXFLAGS="-g -DDEBUG=2" ;; + esac]) AC_CHECK_LIB(gmp, __gmpz_init) AC_CHECK_LIB(readline, readline) dnl On some systems these are in separate libraries. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-04 08:09:10
|
Revision: 169 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=169&view=rev Author: agraef Date: 2008-06-04 01:09:18 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Update installation instructions. Modified Paths: -------------- pure/trunk/INSTALL pure/trunk/README Modified: pure/trunk/INSTALL =================================================================== --- pure/trunk/INSTALL 2008-06-04 07:56:24 UTC (rev 168) +++ pure/trunk/INSTALL 2008-06-04 08:09:18 UTC (rev 169) @@ -363,6 +363,6 @@ installed. -May 2008 +June 2008 Albert Graef <Dr.Graef at t-online.de> Eddie Rucker <erucker at bmc.edu> Modified: pure/trunk/README =================================================================== --- pure/trunk/README 2008-06-04 07:56:24 UTC (rev 168) +++ pure/trunk/README 2008-06-04 08:09:18 UTC (rev 169) @@ -27,13 +27,11 @@ INSTALLATION Please see the INSTALL file for detailed instructions. On most Unix-like -systems, the usual 'make && sudo make install' should do the trick. (No -'configure' step necessary.) This requires GNU make and g++. For other setups, -you'll probably have to fiddle with the Makefile and the sources. The sources -should be pretty portable, but the Makefile really needs GNU make right now. -You'll also need LLVM for the compiler backend (version 2.2 has been tested). -For your convenience, instructions for installing LLVM are also included in -the INSTALL file. +systems, the usual './configure && make && sudo make install' should do the +trick. This requires GNU make and g++. For other setups, you'll probably have +to fiddle with the Makefile and the sources. You'll also need LLVM for the +compiler backend (version 2.2 has been tested). For your convenience, +instructions for installing LLVM are also included in the INSTALL file. USING PURE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-04 08:10:16
|
Revision: 170 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=170&view=rev Author: agraef Date: 2008-06-04 01:10:24 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Move -D options for build types to CPPFLAGS. Modified Paths: -------------- pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-04 08:09:18 UTC (rev 169) +++ pure/trunk/configure 2008-06-04 08:10:24 UTC (rev 170) @@ -2270,7 +2270,7 @@ # Check whether --enable-release was given. if test "${enable_release+set}" = set; then enableval=$enable_release; case "${enableval}" in - yes) CXXFLAGS="-O3 -DNDEBUG -DDEBUG=0" ;; + yes) CPPFLAGS="-DNDEBUG -DDEBUG=0"; CXXFLAGS="-O3" ;; esac fi @@ -2284,7 +2284,7 @@ # Check whether --enable-debug2 was given. if test "${enable_debug2+set}" = set; then enableval=$enable_debug2; case "${enableval}" in - yes) CXXFLAGS="-g -DDEBUG=2" ;; + yes) CPPFLAGS="-DDEBUG=2"; CXXFLAGS="-g" ;; esac fi Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-04 08:09:18 UTC (rev 169) +++ pure/trunk/configure.ac 2008-06-04 08:10:24 UTC (rev 170) @@ -5,7 +5,7 @@ AC_ARG_ENABLE(release, [ --enable-release enable the release build], [case "${enableval}" in - yes) CXXFLAGS="-O3 -DNDEBUG -DDEBUG=0" ;; + yes) CPPFLAGS="-DNDEBUG -DDEBUG=0"; CXXFLAGS="-O3" ;; esac]) AC_ARG_ENABLE(debug, [ --enable-debug enable the debug build], @@ -15,7 +15,7 @@ AC_ARG_ENABLE(debug2, [ --enable-debug2 enable the maintenance build], [case "${enableval}" in - yes) CXXFLAGS="-g -DDEBUG=2" ;; + yes) CPPFLAGS="-DDEBUG=2"; CXXFLAGS="-g" ;; esac]) AC_CHECK_LIB(gmp, __gmpz_init) AC_CHECK_LIB(readline, readline) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-03 22:21:25
|
Revision: 165 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=165&view=rev Author: agraef Date: 2008-06-03 15:21:33 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Add autoconf support. Modified Paths: -------------- pure/trunk/pure.cc pure/trunk/util.cc Added Paths: ----------- pure/trunk/Makefile.in pure/trunk/aclocal.m4 pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac Removed Paths: ------------- pure/trunk/Makefile Deleted: pure/trunk/Makefile =================================================================== --- pure/trunk/Makefile 2008-06-01 20:14:57 UTC (rev 164) +++ pure/trunk/Makefile 2008-06-03 22:21:33 UTC (rev 165) @@ -1,265 +0,0 @@ - -# This Makefile requires GNU make. Really. - -# Basic setup. You can change the version number and installation paths here. - -# For instance, to install under /usr instead of /usr/local, run 'make -# prefix=/usr && make install prefix=/usr'. Please note that the 'prefix' -# option must be specified *both* at build and at installation time. At -# installation time, you can also specify a DESTDIR path if you want to -# install into a staging directory, e.g.: 'make install DESTDIR=$PWD/BUILD'. - -version = 0.3 -dist = pure-$(version) - -prefix = /usr/local -bindir = $(prefix)/bin -libdir = $(prefix)/lib -mandir = $(prefix)/share/man/man1 - -# Shared library suffix. The default should work on most Linux and Unix -# systems. Use DLL=dll on Windows. - -DLL=so - -# Staging directory for 'make install'. If you use this, make sure that this -# ends in a slash. - -DESTDIR= - -# Linker flags. Adjust these as necessary for your system. - -# LDFLAGS is for additional linker options, LIBS for additional libraries that -# might be needed (e.g., -liconv on OSX and Windows). - -LDFLAGS= -LIBS= - -# Compilation flags. We currently provide the following build profiles: - -# 'default' compiles with extra runtime checks and debugging information. -# 'release' optimizes for execution speed (release version). -# 'debug' like 'default', but without any optimizations. -# 'debug2' extensive debugging output, useful to debug the interpreter. - -# The 'default' build should be suitable for most purposes. As of Pure 0.3, -# this build now also does basic optimizations and so isn't much slower than -# the 'release' build any more. In contrast to 'release', this build also -# provides diagnostics useful for maintainers if anything is wrong with the -# interpreter. - -# The 'release' build disables all runtime checks and debugging information -# and compiles with additional optimizations which makes programs go a little -# faster (some 5-10% on a single-cpu AMD system running Linux and gcc 4.1, -# YMMV); use this if performance is critical. - -# The 'debug' build is like 'default' but without any optimizations; it builds -# faster than 'default', but runs *much* slower, and isn't recommended for -# anything but debugging the interpreter. The 'debug2' build generates massive -# amounts of additional debugging messages, and is really only to be used by -# maintainers debugging the interpreter. - -# To build with a given profile, just say 'make build=<profile>', e.g.: 'make -# build=release'. (This option only has to be specified at build time, not for -# installation or any other targets except 'all'.) Just 'make' builds with the -# default flags. - -build=default - -LLVM_FLAGS = `llvm-config --cppflags` -LLVM_LIBS = `llvm-config --ldflags --libs core jit native` - -# NOTE: Some of the following flags are gcc-specific, so you'll have to fiddle -# with the options if you're using a different compiler. - -ifeq ($(build),default) -CXXFLAGS = -g -O -Wall $(LLVM_FLAGS) -CFLAGS = -g -O -Wall -else -ifeq ($(build),release) -CXXFLAGS = -O3 -DNDEBUG -DDEBUG=0 -Wall $(LLVM_FLAGS) -CFLAGS = -O3 -DNDEBUG -DDEBUG=0 -Wall -else -ifeq ($(build),debug) -CXXFLAGS = -g -Wall $(LLVM_FLAGS) -CFLAGS = -g -Wall -else -ifeq ($(build),debug2) -CXXFLAGS = -g -Wall -DDEBUG=2 $(LLVM_FLAGS) -CFLAGS = -g -Wall -DDEBUG=2 -else -CXXFLAGS = -g -O -Wall $(LLVM_FLAGS) -CFLAGS = -g -O -Wall -.PHONY: warn -warn: all - @echo "WARNING: Invalid build profile '$(build)'." - @echo "WARNING: Must be one of 'default', 'release', 'debug' and 'debug2'." - @echo "WARNING: Assuming 'default' profile." -endif -endif -endif -endif - -# Pure library name. Currently we use a simple versioning scheme, which -# requires that the library version matches that of the interpreter. With some -# fiddling, this enables you to install different versions of the Pure -# interpreter on the same system. - -libpure = libpure-$(version).$(DLL) - -# No need to edit below this line. Unless you really have to. :) ############ - -SOURCE = expr.cc expr.hh funcall.h interpreter.cc interpreter.hh lexer.ll \ -matcher.cc matcher.hh parser.yy printer.cc printer.hh \ -runtime.cc runtime.h symtable.cc symtable.hh util.cc util.hh -EXTRA_SOURCE = lexer.cc parser.cc parser.hh location.hh position.hh stack.hh -OBJECT = $(subst .cc,.o,$(filter %.cc,$(SOURCE) $(EXTRA_SOURCE))) -ALL_LIBS = -lreadline -lgmp $(LIBS) - -examples = $(wildcard examples/*.pure) -lib = $(wildcard lib/*.pure) -tests = $(wildcard test/*.pure) -logs = test/prelude.log $(tests:.pure=.log) -distlogs = $(wildcard test/*.log) - -DISTFILES = COPYING ChangeLog INSTALL NEWS README TODO Makefile \ -$(SOURCE) $(EXTRA_SOURCE) w3centities.c pure.cc pure.1 pure.xml pure.vim \ -$(examples) $(lib) $(tests) $(distlogs) - -.PHONY: all html dvi ps pdf clean realclean depend install uninstall strip \ -dist distcheck cleanlogs logs check - -# compilation - -all: pure - -pure: pure.o $(libpure) - $(CXX) -o $@ $(LDFLAGS) pure.o -L. -lpure-$(version) $(ALL_LIBS) - -$(libpure): $(OBJECT) - $(CXX) -shared -o $@ $(LDFLAGS) $(OBJECT) $(LLVM_LIBS) $(ALL_LIBS) - ln -sf $(libpure) libpure.$(DLL) - -pure.o: pure.cc - $(CXX) $(CXXFLAGS) -DVERSION='"$(version)"' -DPURELIB='"$(libdir)/pure"' -c -o $@ $< - -lexer.cc: lexer.ll - flex -o lexer.cc $< - -parser.cc: parser.yy - bison -v -o parser.cc $< - -parser.hh location.hh position.hh stack.hh: parser.cc - -# documentation in various formats (requires groff) - -html: pure.html -dvi: pure.dvi -ps: pure.ps -pdf: pure.pdf - -%.html: %.1 - groff -man -Thtml $< > $@ - -%.dvi: %.1 - groff -man -Tdvi $< > $@ - -%.ps: %.1 - groff -man -Tps $< > $@ - -%.pdf: %.1 - groff -man -Tps $< | ps2pdf - $@ - -# cleaning - -clean: - rm -f *~ *.bak *.html *.dvi *.ps pure $(OBJECT) pure.o libpure.$(DLL) $(libpure) parser.output - -cleanlogs: - rm -f $(logs) - -realclean: clean - rm -f $(EXTRA_SOURCE) $(logs) $(dist).tar.gz - -# dependencies - -depend: $(SOURCE) $(EXTRA_SOURCE) - makedepend -Y $(SOURCE) $(EXTRA_SOURCE) 2> /dev/null - -# installation - -install: pure $(lib) - install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(mandir) - install pure $(DESTDIR)$(bindir)/pure - install $(libpure) $(DESTDIR)$(libdir)/$(libpure) - ln -sf $(libdir)/$(libpure) $(DESTDIR)$(libdir)/libpure.$(DLL) - install -m 644 $(lib) $(DESTDIR)$(libdir)/pure - install -m 644 pure.1 $(DESTDIR)$(mandir)/pure.1 - -uninstall: - rm -rf $(DESTDIR)$(bindir)/pure $(DESTDIR)$(libdir)/$(libpure) $(DESTDIR)$(libdir)/libpure.$(DLL) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(mandir)/pure.1 - -# roll a distribution tarball - -dist: $(DISTFILES) - rm -rf $(dist) - mkdir $(dist) && mkdir $(dist)/examples && mkdir $(dist)/lib && \ -mkdir $(dist)/test - for x in $(DISTFILES); do ln -sf $$PWD/$$x $(dist)/$$x; done - rm -f $(dist).tar.gz - tar cfzh $(dist).tar.gz $(dist) - rm -rf $(dist) - -distcheck: dist - tar xfz $(dist).tar.gz - cd $(dist) && make && make check && make install DESTDIR=./BUILD - rm -rf $(dist) - -# test logs, make check - -level=7 - -logs: $(logs) - -check: pure - @ echo Running tests. - @ (export LD_LIBRARY_PATH=.; export PURELIB=./lib; echo -n "prelude.pure: "; if ./pure -n -v$(level) lib/prelude.pure 2>&1 | diff -q - test/prelude.log > /dev/null; then echo passed; else echo FAILED; fi) - @ (cd test; export LD_LIBRARY_PATH=..; export PURELIB=../lib; for x in $(tests); do f="`basename $$x`"; l="`basename $$x .pure`.log"; echo -n "$$x: "; if ../pure -v$(level) < $$f 2>&1 | diff -q - $$l > /dev/null; then echo passed; else echo FAILED; fi; done) - -test/prelude.log: lib/prelude.pure lib/primitives.pure lib/strings.pure - LD_LIBRARY_PATH=. PURELIB=./lib ./pure -n -v$(level) $< > $@ 2>&1 - -%.log: %.pure - LD_LIBRARY_PATH=. PURELIB=./lib ./pure -v$(level) < $< > $@ 2>&1 - -# DO NOT DELETE - -expr.o: expr.hh interpreter.hh matcher.hh symtable.hh printer.hh runtime.h -expr.o: parser.hh stack.hh util.hh location.hh position.hh -interpreter.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh -interpreter.o: runtime.h parser.hh stack.hh util.hh location.hh position.hh -interpreter.o: expr.hh matcher.hh symtable.hh printer.hh runtime.h parser.hh -interpreter.o: stack.hh util.hh location.hh position.hh -lexer.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh runtime.h -lexer.o: parser.hh stack.hh util.hh location.hh position.hh -matcher.o: matcher.hh expr.hh -matcher.o: expr.hh -parser.o: expr.hh printer.hh matcher.hh runtime.h util.hh interpreter.hh -parser.o: symtable.hh parser.hh stack.hh location.hh position.hh -printer.o: printer.hh expr.hh matcher.hh runtime.h interpreter.hh symtable.hh -printer.o: parser.hh stack.hh util.hh location.hh position.hh -printer.o: expr.hh matcher.hh runtime.h -pure.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh runtime.h -pure.o: parser.hh stack.hh util.hh location.hh position.hh -runtime.o: runtime.h expr.hh interpreter.hh matcher.hh symtable.hh printer.hh -runtime.o: parser.hh stack.hh util.hh location.hh position.hh funcall.h -symtable.o: symtable.hh expr.hh printer.hh matcher.hh runtime.h -symtable.o: expr.hh printer.hh matcher.hh runtime.h -util.o: util.hh w3centities.c -lexer.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh runtime.h -lexer.o: parser.hh stack.hh util.hh location.hh position.hh -parser.o: parser.hh stack.hh expr.hh printer.hh matcher.hh runtime.h util.hh -parser.o: location.hh position.hh interpreter.hh symtable.hh -parser.o: stack.hh expr.hh printer.hh matcher.hh runtime.h util.hh -parser.o: location.hh position.hh -location.o: position.hh Added: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in (rev 0) +++ pure/trunk/Makefile.in 2008-06-03 22:21:33 UTC (rev 165) @@ -0,0 +1,231 @@ + +# This Makefile requires GNU make. Really. + +SHELL = /bin/sh + +# Package information. + +name = @PACKAGE_NAME@ +version = @PACKAGE_VERSION@ +dist = $(name)-$(version) + +# Source and installation paths. + +srcdir = @srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ + +bindir = @bindir@ +includedir = @includedir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ +man1dir = $(mandir)/man1 + +# Staging directory for 'make install'. If you use this, make sure that it +# ends in a slash. + +DESTDIR= + +# OS-specific file suffixes. Windows (EXE=.exe, DLL=.dll) is handled +# automatically by configure, for other systems with unusual conventions set +# these as needed. + +EXE=@EXEEXT@ +ifeq ($(EXE),.exe) +DLL=.dll +else +DLL=.so +endif + +# Linker flags and required libraries. These are determined automatically by +# configure. Use EXTRA_LIBS to add any additional platform-specific libraries +# that might be required. + +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ $(EXTRA_LIBS) + +ifeq ($(EXE),.exe) +EXTRA_LIBS = -limagehlp -lpsapi +else +EXTRA_LIBS = +endif + +# Compilation flags. + +LLVM_FLAGS = `llvm-config --cppflags` +LLVM_LIBS = `llvm-config --ldflags --libs core jit native` + +CPPFLAGS = @CPPFLAGS@ $(LLVM_FLAGS) +CXXFLAGS = @CXXFLAGS@ -Wall + +# Pure library name. Currently we use a simple versioning scheme, which +# requires that the library version matches that of the interpreter. With some +# fiddling, this enables you to install different versions of the Pure +# interpreter on the same system. + +libpure_base = $(name) +libpure_vers = $(libpure_base)-$(version) + +libpure = lib$(libpure_vers)$(DLL) +libpurelnk = lib$(libpure_base)$(DLL) +LIBPURE = -l$(libpure_vers) + +# No need to edit below this line. Unless you really have to. :) ############ + +SOURCE = expr.cc expr.hh funcall.h interpreter.cc interpreter.hh lexer.ll \ +matcher.cc matcher.hh parser.yy printer.cc printer.hh \ +runtime.cc runtime.h symtable.cc symtable.hh util.cc util.hh +EXTRA_SOURCE = lexer.cc parser.cc parser.hh location.hh position.hh stack.hh +OBJECT = $(subst .cc,.o,$(filter %.cc,$(SOURCE) $(EXTRA_SOURCE))) + +DISTFILES = COPYING ChangeLog INSTALL NEWS README TODO \ +Makefile.in aclocal.m4 configure.ac configure config.h.in \ +$(SOURCE) $(EXTRA_SOURCE) w3centities.c pure.cc pure.1 pure.xml pure.vim \ +examples/*.pure lib/*.pure test/*.pure test/*.log + +.PHONY: all html dvi ps pdf clean realclean depend install uninstall strip \ +dist distcheck cleanlogs logs check + +# compilation + +all: pure$(EXE) + +pure$(EXE): pure.o $(libpure) + $(CXX) -o $@ $(LDFLAGS) pure.o -L. $(LIBPURE) $(LIBS) + +$(libpure): $(OBJECT) + $(CXX) -shared -o $@ $(LDFLAGS) $(OBJECT) $(LLVM_LIBS) $(LIBS) + ln -sf $(libpure) $(libpurelnk) + +pure.o: pure.cc + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -DPURELIB='"$(libdir)/pure"' -c -o $@ $< + +lexer.cc: lexer.ll + flex -o lexer.cc $< + +parser.cc: parser.yy + bison -v -o parser.cc $< + +parser.hh location.hh position.hh stack.hh: parser.cc + +# documentation in various formats (requires groff) + +html: pure.html +dvi: pure.dvi +ps: pure.ps +pdf: pure.pdf + +%.html: %.1 + groff -man -Thtml $< > $@ + +%.dvi: %.1 + groff -man -Tdvi $< > $@ + +%.ps: %.1 + groff -man -Tps $< > $@ + +%.pdf: %.1 + groff -man -Tps $< | ps2pdf - $@ + +# cleaning + +clean: + rm -f *~ *.bak *.html *.dvi *.ps *.pdf pure$(EXE) $(OBJECT) pure.o $(libpurelnk) $(libpure) parser.output + +distclean: clean + rm -f Makefile config.h config.log config.status $(dist).tar.gz + +realclean: distclean + rm -f $(addprefix $(srcdir)/, test/*.log $(EXTRA_SOURCE)) + +# dependencies (rerun configure after this) + +depend: $(SOURCE) $(EXTRA_SOURCE) + (cd $(srcdir) && makedepend -f Makefile.in -Y pure.cc $(SOURCE) $(EXTRA_SOURCE) 2> /dev/null) + +# installation + +install: pure$(EXE) + install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(man1dir) + install pure$(EXE) $(DESTDIR)$(bindir)/pure$(EXE) + install $(libpure) $(DESTDIR)$(libdir)/$(libpure) + ln -sf $(libdir)/$(libpure) $(DESTDIR)$(libdir)/$(libpurelnk) + install -m 644 $(srcdir)/lib/*.pure $(DESTDIR)$(libdir)/pure + install -m 644 pure.1 $(DESTDIR)$(man1dir)/pure.1 + +uninstall: + rm -rf $(DESTDIR)$(bindir)/pure$(EXE) $(DESTDIR)$(libdir)/$(libpure) $(DESTDIR)$(libdir)/$(libpurelnk) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(man1dir)/pure.1 + +# roll a distribution tarball + +dist: + rm -rf $(dist) + mkdir $(dist) && mkdir $(dist)/examples && mkdir $(dist)/lib && mkdir $(dist)/test + (builddir=$$PWD; cd $(srcdir); for x in $(DISTFILES); do ln -sf $$PWD/$$x $$builddir/$(dist)/$$x; done) + rm -f $(dist).tar.gz + tar cfzh $(dist).tar.gz $(dist) + rm -rf $(dist) + +distcheck: dist + tar xfz $(dist).tar.gz + cd $(dist) && ./configure && make && make check && make install DESTDIR=./BUILD + rm -rf $(dist) + +# test logs, make check + +level=7 + +tests = $(wildcard $(srcdir)/test/*.pure) +logs = $(srcdir)/test/prelude.log $(tests:.pure=.log) + +logs: $(logs) + +cleanlogs: + rm -f $(srcdir)/test/*.log + +$(srcdir)/test/prelude.log: lib/prelude.pure lib/primitives.pure lib/strings.pure + LD_LIBRARY_PATH=. PURELIB=$(srcdir)/lib ./pure -n -v$(level) $< > $@ 2>&1 + +%.log: %.pure + LD_LIBRARY_PATH=. PURELIB=$(srcdir)/lib ./pure -v$(level) < $< > $@ 2>&1 + +check: pure + @ echo Running tests. + @ (export LD_LIBRARY_PATH=.; export PURELIB=$(srcdir)/lib; echo -n "prelude.pure: "; if ./pure -n -v$(level) $(srcdir)/lib/prelude.pure 2>&1 | diff -q - $(srcdir)/test/prelude.log > /dev/null; then echo passed; else echo FAILED; fi) + @ (export LD_LIBRARY_PATH=.; export PURELIB=$(srcdir)/lib; for x in $(notdir $(tests)); do echo -n "$$x: "; if ./pure -v$(level) < $(srcdir)/test/$$x 2>&1 | diff -q - $(srcdir)/test/"`basename $$x .pure`.log" > /dev/null; then echo passed; else echo FAILED; fi; done) + +# DO NOT DELETE + +pure.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh runtime.h +pure.o: parser.hh stack.hh util.hh location.hh position.hh config.h +expr.o: expr.hh interpreter.hh matcher.hh symtable.hh printer.hh runtime.h +expr.o: parser.hh stack.hh util.hh location.hh position.hh +interpreter.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh +interpreter.o: runtime.h parser.hh stack.hh util.hh location.hh position.hh +interpreter.o: expr.hh matcher.hh symtable.hh printer.hh runtime.h parser.hh +interpreter.o: stack.hh util.hh location.hh position.hh +lexer.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh runtime.h +lexer.o: parser.hh stack.hh util.hh location.hh position.hh +matcher.o: matcher.hh expr.hh +matcher.o: expr.hh +parser.o: expr.hh printer.hh matcher.hh runtime.h util.hh interpreter.hh +parser.o: symtable.hh parser.hh stack.hh location.hh position.hh +printer.o: printer.hh expr.hh matcher.hh runtime.h interpreter.hh symtable.hh +printer.o: parser.hh stack.hh util.hh location.hh position.hh +printer.o: expr.hh matcher.hh runtime.h +runtime.o: runtime.h expr.hh interpreter.hh matcher.hh symtable.hh printer.hh +runtime.o: parser.hh stack.hh util.hh location.hh position.hh funcall.h +symtable.o: symtable.hh expr.hh printer.hh matcher.hh runtime.h +symtable.o: expr.hh printer.hh matcher.hh runtime.h +util.o: util.hh config.h w3centities.c +lexer.o: interpreter.hh expr.hh matcher.hh symtable.hh printer.hh runtime.h +lexer.o: parser.hh stack.hh util.hh location.hh position.hh +parser.o: parser.hh stack.hh expr.hh printer.hh matcher.hh runtime.h util.hh +parser.o: location.hh position.hh interpreter.hh symtable.hh +parser.o: stack.hh expr.hh printer.hh matcher.hh runtime.h util.hh +parser.o: location.hh position.hh +location.o: position.hh Added: pure/trunk/aclocal.m4 =================================================================== --- pure/trunk/aclocal.m4 (rev 0) +++ pure/trunk/aclocal.m4 2008-06-03 22:21:33 UTC (rev 165) @@ -0,0 +1,84 @@ +dnl iconv check from Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + am_cv_lib_iconv_ldpath= + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $am_cv_libiconv_ldpath -liconv" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="$am_cv_lib_iconv_ldpath -liconv" + fi + AC_SUBST(LIBICONV) +]) + +dnl nl_langinfo/CODESET check from Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include <langinfo.h>], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) + fi +]) Added: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in (rev 0) +++ pure/trunk/config.h.in 2008-06-03 22:21:33 UTC (rev 165) @@ -0,0 +1,37 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV + +/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define to 1 if you have the `glob' library (-lglob). */ +#undef HAVE_LIBGLOB + +/* Define to 1 if you have the `gmp' library (-lgmp). */ +#undef HAVE_LIBGMP + +/* Define to 1 if you have the `readline' library (-lreadline). */ +#undef HAVE_LIBREADLINE + +/* Define to 1 if you have the `regex' library (-lregex). */ +#undef HAVE_LIBREGEX + +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION Added: pure/trunk/configure =================================================================== --- pure/trunk/configure (rev 0) +++ pure/trunk/configure 2008-06-03 22:21:33 UTC (rev 165) @@ -0,0 +1,4587 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for pure 0.3. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 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 more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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 + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +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) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + 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=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell aut...@gn... about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # 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 after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +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$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + + +exec 7<&0 </dev/null 6>&1 + +# 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` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='pure' +PACKAGE_TARNAME='pure' +PACKAGE_VERSION='0.3' +PACKAGE_STRING='pure 0.3' +PACKAGE_BUGREPORT='' + +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 +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CXX +EXEEXT +OBJEXT +CC +CFLAGS +ac_ct_CC +LIBICONV +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS +CCC +CC +CFLAGS' + + +# 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. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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 + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$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 ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -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'` + 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 ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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'` + 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; }; } + 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 directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +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 + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# 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 pure 0.3 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 \`..'] + +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] + --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] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/pure] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of pure 0.3:";; + esac + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CC C compiler command + CFLAGS C 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 +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +pure configure 0.3 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by pure $as_me 0.3, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || ... [truncated message content] |
From: <ag...@us...> - 2008-06-04 09:05:22
|
Revision: 171 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=171&view=rev Author: agraef Date: 2008-06-04 02:05:30 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Add option to link interpreter statically. Modified Paths: -------------- pure/trunk/Makefile.in pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in 2008-06-04 08:10:24 UTC (rev 170) +++ pure/trunk/Makefile.in 2008-06-04 09:05:30 UTC (rev 171) @@ -73,6 +73,12 @@ libpurelnk = lib$(libpure_base)$(DLL) LIBPURE = -l$(libpure_vers) +# Whether to build the Pure library. If this is set to anything but "yes", the +# interpreter will be linked statically. This is necessary on some systems +# where LLVM cannot be linked in dynamically. + +SHARED = @SHARED@ + # No need to edit below this line. Unless you really have to. :) ############ SOURCE = expr.cc expr.hh funcall.h interpreter.cc interpreter.hh lexer.ll \ @@ -93,8 +99,13 @@ all: pure$(EXE) +ifeq ($(SHARED), yes) pure$(EXE): pure.o $(libpure) $(CXX) -o $@ $(LDFLAGS) pure.o -L. $(LIBPURE) $(LIBS) +else +pure$(EXE): pure.o $(OBJECT) + $(CXX) -o $@ $(LDFLAGS) pure.o $(OBJECT) $(LLVM_LIBS) $(LIBS) +endif $(libpure): $(OBJECT) $(CXX) -shared -o $@ $(LDFLAGS) $(OBJECT) $(LLVM_LIBS) $(LIBS) @@ -151,8 +162,10 @@ install: pure$(EXE) install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(man1dir) install pure$(EXE) $(DESTDIR)$(bindir)/pure$(EXE) +ifeq ($(SHARED), yes) install $(libpure) $(DESTDIR)$(libdir)/$(libpure) ln -sf $(libdir)/$(libpure) $(DESTDIR)$(libdir)/$(libpurelnk) +endif install -m 644 $(srcdir)/lib/*.pure $(DESTDIR)$(libdir)/pure install -m 644 pure.1 $(DESTDIR)$(man1dir)/pure.1 Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-04 08:10:24 UTC (rev 170) +++ pure/trunk/configure 2008-06-04 09:05:30 UTC (rev 171) @@ -620,6 +620,7 @@ ac_ct_CXX EXEEXT OBJEXT +SHARED CC CFLAGS ac_ct_CC @@ -1211,6 +1212,7 @@ --enable-release enable the release build --enable-debug enable the debug build --enable-debug2 enable the maintenance build + --disable-shared link the interpreter statically Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2288,6 +2290,15 @@ esac fi +SHARED=yes +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; case "${enableval}" in + no) LDFLAGS=-rdynamic; SHARED=no ;; + esac +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4181,6 +4192,7 @@ ac_ct_CXX!$ac_ct_CXX$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim +SHARED!$SHARED$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim @@ -4189,7 +4201,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 50; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 51; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-04 08:10:24 UTC (rev 170) +++ pure/trunk/configure.ac 2008-06-04 09:05:30 UTC (rev 171) @@ -17,6 +17,13 @@ [case "${enableval}" in yes) CPPFLAGS="-DDEBUG=2"; CXXFLAGS="-g" ;; esac]) +SHARED=yes +AC_ARG_ENABLE(shared, + [ --disable-shared link the interpreter statically], + [case "${enableval}" in + no) LDFLAGS=-rdynamic; SHARED=no ;; + esac]) +AC_SUBST(SHARED) AC_CHECK_LIB(gmp, __gmpz_init) AC_CHECK_LIB(readline, readline) dnl On some systems these are in separate libraries. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-04 23:35:17
|
Revision: 176 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=176&view=rev Author: agraef Date: 2008-06-04 16:35:22 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Some minor fixes in configury and build system, provide feedback about configure results. Modified Paths: -------------- pure/trunk/Makefile.in pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in 2008-06-04 22:49:01 UTC (rev 175) +++ pure/trunk/Makefile.in 2008-06-04 23:35:22 UTC (rev 176) @@ -37,6 +37,11 @@ EXE=@EXEEXT@ DLL=@DLLEXT@ +# Programs. + +CXX = @CXX@ +INSTALL = @INSTALL@ + # Linker flags and required libraries. These are determined automatically by # configure, but if necessary you can also change these on the command line. @@ -151,14 +156,14 @@ # installation install: pure$(EXE) - install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(man1dir) - install pure$(EXE) $(DESTDIR)$(bindir)/pure$(EXE) + for x in $(addprefix $(DESTDIR), $(bindir) $(libdir)/pure $(man1dir)); do $(INSTALL) -d $$x; done + $(INSTALL) pure$(EXE) $(DESTDIR)$(bindir)/pure$(EXE) ifeq ($(SHARED), yes) - install $(libpure) $(DESTDIR)$(libdir)/$(libpure) + $(INSTALL) $(libpure) $(DESTDIR)$(libdir)/$(libpure) ln -sf $(libdir)/$(libpure) $(DESTDIR)$(libdir)/$(libpurelnk) endif - install -m 644 $(srcdir)/lib/*.pure $(DESTDIR)$(libdir)/pure - install -m 644 pure.1 $(DESTDIR)$(man1dir)/pure.1 + for x in $(srcdir)/lib/*.pure; do $(INSTALL) -m 644 $$x $(DESTDIR)$(libdir)/pure; done + $(INSTALL) -m 644 pure.1 $(DESTDIR)$(man1dir)/pure.1 uninstall: rm -rf $(DESTDIR)$(bindir)/pure$(EXE) $(DESTDIR)$(libdir)/$(libpure) $(DESTDIR)$(libdir)/$(libpurelnk) $(DESTDIR)$(libdir)/pure $(DESTDIR)$(man1dir)/pure.1 Modified: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in 2008-06-04 22:49:01 UTC (rev 175) +++ pure/trunk/config.h.in 2008-06-04 23:35:22 UTC (rev 176) @@ -18,7 +18,7 @@ /* Define to 1 if you have the `regex' library (-lregex). */ #undef HAVE_LIBREGEX -/* Define to the canonical host system name. */ +/* Define to the name of the host system. */ #undef HOST /* Define as const if the declaration of iconv() needs const. */ Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-04 22:49:01 UTC (rev 175) +++ pure/trunk/configure 2008-06-04 23:35:22 UTC (rev 176) @@ -623,6 +623,9 @@ host_os RDYNAMIC DLLEXT +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA CXX CXXFLAGS LDFLAGS @@ -1811,6 +1814,86 @@ esac +# 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + + +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. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + 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' + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4137,6 +4220,7 @@ ac_pwd='$ac_pwd' srcdir='$srcdir' +INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -4344,6 +4428,9 @@ host_os!$host_os$ac_delim RDYNAMIC!$RDYNAMIC$ac_delim DLLEXT!$DLLEXT$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim @@ -4360,7 +4447,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 61; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 64; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -4583,6 +4670,10 @@ # CONFIG_FILE # + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -4635,6 +4726,7 @@ s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out @@ -4784,3 +4876,30 @@ $ac_cs_success || { (exit 1); exit 1; } fi + +{ echo "$as_me:$LINENO: result: +Pure is now configured for ${host}. + + Source directory: ${srcdir} + Installation prefix: ${prefix} + Compiler: $CXX $CXXFLAGS $CPPFLAGS + Linker: $CXX $LDFLAGS $LIBS + Build libpure: $SHARED + +Now run 'make' to build everything, and 'make install' to install this +software on your system. To remove the installed software at a later +time use the 'make uninstall' command. +" >&5 +echo "${ECHO_T} +Pure is now configured for ${host}. + + Source directory: ${srcdir} + Installation prefix: ${prefix} + Compiler: $CXX $CXXFLAGS $CPPFLAGS + Linker: $CXX $LDFLAGS $LIBS + Build libpure: $SHARED + +Now run 'make' to build everything, and 'make install' to install this +software on your system. To remove the installed software at a later +time use the 'make uninstall' command. +" >&6; } Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-04 22:49:01 UTC (rev 175) +++ pure/trunk/configure.ac 2008-06-04 23:35:22 UTC (rev 176) @@ -1,11 +1,12 @@ AC_INIT(pure, 0.3) AC_CONFIG_HEADERS(config.h) +dnl Determine host information. AC_CANONICAL_HOST if test -z "${host}"; then host=unknown fi -AC_DEFINE_UNQUOTED(HOST, "${host}", [Define to the canonical host system name.]) +AC_DEFINE_UNQUOTED(HOST, "${host}", [Define to the name of the host system.]) AC_SUBST(host) dnl Figure out extra build flags and filename extensions for various systems. RDYNAMIC= @@ -20,7 +21,10 @@ esac AC_SUBST(RDYNAMIC) AC_SUBST(DLLEXT) +dnl Check for programs. +AC_PROG_INSTALL AC_PROG_CXX +dnl Parse --enable options. AC_ARG_ENABLE(release, [ --enable-release enable the release build], [case "${enableval}" in @@ -43,13 +47,28 @@ no) LDFLAGS="$LDFLAGS $RDYNAMIC"; SHARED=no ;; esac]) AC_SUBST(SHARED) +dnl Check for libraries. AC_CHECK_LIB(gmp, __gmpz_init) AC_CHECK_LIB(readline, readline) dnl On some systems these are in separate libraries. AC_CHECK_LIB(glob, glob) AC_CHECK_LIB(regex, regcomp) -dnl iconv needs special treatment (macro pilfered from automake). +dnl iconv and nl_langinfo need special treatment (macros by Bruno Haible). AM_ICONV AM_LANGINFO_CODESET AC_CONFIG_FILES([Makefile]) AC_OUTPUT + +AC_MSG_RESULT([ +Pure is now configured for ${host}. + + Source directory: ${srcdir} + Installation prefix: ${prefix} + Compiler: $CXX $CXXFLAGS $CPPFLAGS + Linker: $CXX $LDFLAGS $LIBS + Build libpure: $SHARED + +Now run 'make' to build everything, and 'make install' to install this +software on your system. To remove the installed software at a later +time use the 'make uninstall' command. +]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-04 23:58:48
|
Revision: 177 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=177&view=rev Author: agraef Date: 2008-06-04 16:58:56 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Provide host system information in the interpreter. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/interpreter.hh pure/trunk/pure.1 pure/trunk/pure.cc Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-06-04 23:35:22 UTC (rev 176) +++ pure/trunk/interpreter.cc 2008-06-04 23:58:56 UTC (rev 177) @@ -297,9 +297,10 @@ } void interpreter::init_sys_vars(const string& version, + const string& host, const list<string>& argv) { - // command line arguments and version information + // command line arguments, system and version information pure_expr *args = pure_const(symtab.nil_sym().f); for (list<string>::const_reverse_iterator it = argv.rbegin(); it != argv.rend(); it++) { @@ -311,6 +312,7 @@ defn("argc", pure_int(argv.size())); defn("argv", args); defn("version", pure_cstring_dup(version.c_str())); + defn("sysinfo", pure_cstring_dup(host.c_str())); } // Errors and warnings. Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-06-04 23:35:22 UTC (rev 176) +++ pure/trunk/interpreter.hh 2008-06-04 23:58:56 UTC (rev 177) @@ -245,6 +245,7 @@ virtual ~interpreter(); // Populate the global environment with some useful variables. void init_sys_vars(const string& version = "", + const string& host = "", const list<string>& argv = list<string>()); // Option data. You can modify these according to your needs. Modified: pure/trunk/pure.1 =================================================================== --- pure/trunk/pure.1 2008-06-04 23:35:22 UTC (rev 176) +++ pure/trunk/pure.1 2008-06-04 23:58:56 UTC (rev 177) @@ -67,7 +67,9 @@ .B argv variables. Moreover, the .B version -variable is set to the Pure interpreter version. +variable is set to the Pure interpreter version, and the +.B sysinfo +variable provides information about the host system. .PP If available, the prelude script .B prelude.pure @@ -902,8 +904,9 @@ > \fBlist\fP -lv argc var argc = 0; argv var argv = []; +sysinfo var sysinfo = "i686-pc-linux-gnu"; version var version = "0.1"; -3 variables +4 variables .fi .PP If you're like me then you'll frequently have to look up how some operations Modified: pure/trunk/pure.cc =================================================================== --- pure/trunk/pure.cc 2008-06-04 23:35:22 UTC (rev 176) +++ pure/trunk/pure.cc 2008-06-04 23:58:56 UTC (rev 177) @@ -18,6 +18,9 @@ using namespace std; +#ifndef HOST +#define HOST "unknown" +#endif #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "0.0" #endif @@ -190,7 +193,8 @@ list<string> myargs; for (char **args = ++argv; *args; ++args) if (*args == string("-h")) { - cout << "Pure " << PACKAGE_VERSION << " " << COPYRIGHT << endl << USAGE; + cout << "Pure " << PACKAGE_VERSION << " (" << HOST << ") " + << COPYRIGHT << endl << USAGE; return 0; } else if (*args == string("-i")) force_interactive = true; @@ -212,7 +216,7 @@ interp.error(prog + ": invalid option " + *args); return 1; } - interp.init_sys_vars(PACKAGE_VERSION, myargs); + interp.init_sys_vars(PACKAGE_VERSION, HOST, myargs); if (want_prelude) { // load the prelude if we can find it FILE *fp = fopen("prelude.pure", "r"); @@ -252,7 +256,8 @@ interp.interactive = true; if (isatty(fileno(stdin))) { // connected to a terminal, print sign-on and initialize readline - cout << "Pure " << PACKAGE_VERSION << " " << COPYRIGHT << endl << LICENSE; + cout << "Pure " << PACKAGE_VERSION << " (" << HOST << ") " + << COPYRIGHT << endl << LICENSE; if (have_prelude) cout << "Loaded prelude from " << prelude << ".\n\n"; rl_readline_name = "Pure"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-05 01:09:26
|
Revision: 179 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=179&view=rev Author: agraef Date: 2008-06-04 18:09:34 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Windows compatibility fixes. Modified Paths: -------------- pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in 2008-06-05 00:21:39 UTC (rev 178) +++ pure/trunk/config.h.in 2008-06-05 01:09:34 UTC (rev 179) @@ -12,6 +12,9 @@ /* Define to 1 if you have the `gmp' library (-lgmp). */ #undef HAVE_LIBGMP +/* Define to 1 if you have the `iconv' library (-liconv). */ +#undef HAVE_LIBICONV + /* Define to 1 if you have the `readline' library (-lreadline). */ #undef HAVE_LIBREADLINE Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-05 00:21:39 UTC (rev 178) +++ pure/trunk/configure 2008-06-05 01:09:34 UTC (rev 179) @@ -1805,8 +1805,8 @@ RDYNAMIC= DLLEXT=".so" case "$host" in - *-*-mingw*) RDYNAMIC="-rdynamic"; LIBS= "-limagehlp -lpsapi"; - DLLEXT=".dll";; + *-*-mingw*) RDYNAMIC="-rdynamic"; LIBS="$LIBS -limagehlp -lpsapi"; + LDFLAGS="-Wl,--enable-auto-import"; DLLEXT=".dll";; *-*-linux*) RDYNAMIC="-rdynamic";; *-*-freebsd*) RDYNAMIC="-rdynamic";; *-*-darwin*) DLLEXT=".dylib";; @@ -3351,6 +3351,150 @@ fi +{ echo "$as_me:$LINENO: checking for iconv in -liconv" >&5 +echo $ECHO_N "checking for iconv in -liconv... $ECHO_C" >&6; } +if test "${ac_cv_lib_iconv_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $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 GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char iconv (); +int +main () +{ +return iconv (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_iconv_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_iconv_iconv=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_iconv" >&6; } +if test $ac_cv_lib_iconv_iconv = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBICONV 1 +_ACEOF + + LIBS="-liconv $LIBS" + +fi + +if test $ac_cv_lib_iconv_iconv = no; then + +{ echo "$as_me:$LINENO: checking for libiconv in -liconv" >&5 +echo $ECHO_N "checking for libiconv in -liconv... $ECHO_C" >&6; } +if test "${ac_cv_lib_iconv_libiconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $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 GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char libiconv (); +int +main () +{ +return libiconv (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_iconv_libiconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_iconv_libiconv=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_libiconv" >&6; } +if test $ac_cv_lib_iconv_libiconv = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBICONV 1 +_ACEOF + + LIBS="-liconv $LIBS" + +fi + +fi + { echo "$as_me:$LINENO: checking for glob in -lglob" >&5 echo $ECHO_N "checking for glob in -lglob... $ECHO_C" >&6; } if test "${ac_cv_lib_glob_glob+set}" = set; then @@ -3421,7 +3565,80 @@ fi +if test $ac_cv_lib_glob_glob = no; then +{ echo "$as_me:$LINENO: checking for xxglob in -lglob" >&5 +echo $ECHO_N "checking for xxglob in -lglob... $ECHO_C" >&6; } +if test "${ac_cv_lib_glob_xxglob+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lglob $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 GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char xxglob (); +int +main () +{ +return xxglob (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_glob_xxglob=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_glob_xxglob=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_glob_xxglob" >&5 +echo "${ECHO_T}$ac_cv_lib_glob_xxglob" >&6; } +if test $ac_cv_lib_glob_xxglob = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGLOB 1 +_ACEOF + + LIBS="-lglob $LIBS" + +fi + +fi + { echo "$as_me:$LINENO: checking for regcomp in -lregex" >&5 echo $ECHO_N "checking for regcomp in -lregex... $ECHO_C" >&6; } if test "${ac_cv_lib_regex_regcomp+set}" = set; then @@ -3492,8 +3709,81 @@ fi +if test $ac_cv_lib_regex_regcomp = no; then +{ echo "$as_me:$LINENO: checking for xxregcomp in -lregex" >&5 +echo $ECHO_N "checking for xxregcomp in -lregex... $ECHO_C" >&6; } +if test "${ac_cv_lib_regex_xxregcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lregex $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 GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char xxregcomp (); +int +main () +{ +return xxregcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_regex_xxregcomp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_regex_xxregcomp=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_regex_xxregcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_regex_xxregcomp" >&6; } +if test $ac_cv_lib_regex_xxregcomp = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBREGEX 1 +_ACEOF + + LIBS="-lregex $LIBS" + +fi + +fi + + am_cv_lib_iconv_ldpath= # Check whether --with-libiconv-prefix was given. Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-05 00:21:39 UTC (rev 178) +++ pure/trunk/configure.ac 2008-06-05 01:09:34 UTC (rev 179) @@ -12,8 +12,8 @@ RDYNAMIC= DLLEXT=".so" case "$host" in - *-*-mingw*) RDYNAMIC="-rdynamic"; LIBS= "-limagehlp -lpsapi"; - DLLEXT=".dll";; + *-*-mingw*) RDYNAMIC="-rdynamic"; LIBS="$LIBS -limagehlp -lpsapi"; + LDFLAGS="-Wl,--enable-auto-import"; DLLEXT=".dll";; *-*-linux*) RDYNAMIC="-rdynamic";; *-*-freebsd*) RDYNAMIC="-rdynamic";; *-*-darwin*) DLLEXT=".dylib";; @@ -50,9 +50,19 @@ dnl Check for libraries. AC_CHECK_LIB(gmp, __gmpz_init) AC_CHECK_LIB(readline, readline) -dnl On some systems these are in separate libraries. +dnl On some systems these are in separate libraries, and may have other names. +AC_CHECK_LIB(iconv, iconv) +if test $ac_cv_lib_iconv_iconv = no; then + AC_CHECK_LIB(iconv, libiconv) +fi AC_CHECK_LIB(glob, glob) +if test $ac_cv_lib_glob_glob = no; then + AC_CHECK_LIB(glob, xxglob) +fi AC_CHECK_LIB(regex, regcomp) +if test $ac_cv_lib_regex_regcomp = no; then + AC_CHECK_LIB(regex, xxregcomp) +fi dnl iconv and nl_langinfo need special treatment (macros by Bruno Haible). AM_ICONV AM_LANGINFO_CODESET This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-04 22:48:54
|
Revision: 175 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=175&view=rev Author: agraef Date: 2008-06-04 15:49:01 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Add host type information, so that configure can handle some host-specific kludges. Modified Paths: -------------- pure/trunk/Makefile.in pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac Added Paths: ----------- pure/trunk/config.guess pure/trunk/config.sub pure/trunk/install-sh Modified: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in 2008-06-04 22:47:13 UTC (rev 174) +++ pure/trunk/Makefile.in 2008-06-04 22:49:01 UTC (rev 175) @@ -3,12 +3,14 @@ SHELL = /bin/sh -# Package information. +# Package and host information. name = @PACKAGE_NAME@ version = @PACKAGE_VERSION@ dist = $(name)-$(version) +host = @host@ + # Source and installation paths. srcdir = @srcdir@ @@ -29,30 +31,18 @@ DESTDIR= -# OS-specific file suffixes. Windows (EXE=.exe, DLL=.dll) is handled -# automatically by configure, for other systems with unusual conventions set -# these as needed. +# OS-specific special filename extensions. configure tries to guess this, but +# if it guesses wrong, you can set these as needed. EXE=@EXEEXT@ -ifeq ($(EXE),.exe) -DLL=.dll -else -DLL=.so -endif +DLL=@DLLEXT@ # Linker flags and required libraries. These are determined automatically by -# configure. Use EXTRA_LIBS to add any additional platform-specific libraries -# that might be required. +# configure, but if necessary you can also change these on the command line. LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ $(EXTRA_LIBS) +LIBS = @LIBS@ -ifeq ($(EXE),.exe) -EXTRA_LIBS = -limagehlp -lpsapi -else -EXTRA_LIBS = -endif - # Compilation flags. LLVM_FLAGS = `llvm-config --cppflags` @@ -74,8 +64,9 @@ LIBPURE = -l$(libpure_vers) # Whether to build the Pure library. If this is set to anything but "yes", the -# interpreter will be linked statically. This is necessary on some systems -# where LLVM cannot be linked in dynamically. +# interpreter is linked statically and no separate runtime library is +# produced. This is necessary on some systems where LLVM cannot be linked in +# dynamically. SHARED = @SHARED@ Added: pure/trunk/config.guess =================================================================== --- pure/trunk/config.guess (rev 0) +++ pure/trunk/config.guess 2008-06-04 22:49:01 UTC (rev 175) @@ -0,0 +1,1513 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2007-01-15' + +# 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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 <pe...@bo...>. +# Please send patches to <con...@gn...>. 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 <con...@gn...>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # 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 "$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 ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (gh...@no... 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 ;; + sh5el) machine=sh5le-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 ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # 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 Pn.n version is a patched version. + # 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/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + 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 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # ak...@wp... (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 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + 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 ;; + 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 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + 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 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # 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 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* 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 && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + 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 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????: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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + 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 ;; + *: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 <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + 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 ;; + *: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 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 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 <stdlib.h> + #include <unistd.h> + + 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 + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + 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 && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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 ;; + 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 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[3456]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[3456]* | authenticamd:Interix*:[3456]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 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 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *: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 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + 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 | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + 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 | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + 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 ;; + 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 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; + 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 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # 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 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + 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 ;; + 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 ;; + 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 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + 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 ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + 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 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/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 ;; + 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 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + 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 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 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 | S7501*:*: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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *: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 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Ric...@cc...> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <he...@op...>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From se...@sw.... + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Pau...@st.... + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Pau...@st.... + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + 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 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *: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 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *: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 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +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 <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#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 <sys/param.h> + 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\n"); 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 <sys/param.h> +# 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 && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# 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 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <con...@gn...> 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: Property changes on: pure/trunk/config.guess ___________________________________________________________________ Name: svn:executable + * Modified: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in 2008-06-04 22:47:13 UTC (rev 174) +++ pure/trunk/config.h.in 2008-06-04 22:49:01 UTC (rev 175) @@ -18,6 +18,9 @@ /* Define to 1 if you have the `regex' library (-lregex). */ #undef HAVE_LIBREGEX +/* Define to the canonical host system name. */ +#undef HOST + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST Added: pure/trunk/config.sub =================================================================== --- pure/trunk/config.sub (rev 0) +++ pure/trunk/config.sub 2008-06-04 22:49:01 UTC (rev 175) @@ -0,0 +1,1622 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2007-01-18' + +# 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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 <con...@gn...>. 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 <con...@gn...>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # 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 ;; + + * ) + 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-newlib* | 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 | -knuth | -cray) + 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 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -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/'` + ;; + -sco5v6*) + # 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 | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | 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) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # 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-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-... [truncated message content] |
From: <ag...@us...> - 2008-06-06 17:58:46
|
Revision: 182 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=182&view=rev Author: agraef Date: 2008-06-06 10:58:53 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Windows compatibility fixes. Modified Paths: -------------- pure/trunk/Makefile.in pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac pure/trunk/interpreter.cc pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/Makefile.in 2008-06-06 17:58:53 UTC (rev 182) @@ -54,7 +54,7 @@ LLVM_LIBS = `llvm-config --ldflags --libs core jit native` CPPFLAGS = @CPPFLAGS@ $(LLVM_FLAGS) -CXXFLAGS = @CXXFLAGS@ -Wall +CXXFLAGS = @CXXFLAGS@ # Pure library name. Currently we use a simple versioning scheme, which # requires that the library version matches that of the interpreter. With some @@ -75,6 +75,16 @@ SHARED = @SHARED@ +# Auxiliary libraries to be loaded at runtime. Usually this is just libpure +# (when built), but on some systems we have to load additional dlls to resolve +# some library functions. + +ifeq ($(SHARED), yes) +AUXLIBS = -DLIBPURE='"$(libpure)"' @AUXLIBS@ +else +AUXLIBS = @AUXLIBS@ +endif + # No need to edit below this line. Unless you really have to. :) ############ SOURCE = expr.cc expr.hh funcall.h interpreter.cc interpreter.hh lexer.ll \ @@ -111,6 +121,9 @@ pure.o: pure.cc $(CXX) $(CXXFLAGS) $(CPPFLAGS) -DPURELIB='"$(libdir)/pure"' -c -o $@ $< +interpreter.o: interpreter.cc + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(AUXLIBS) -c -o $@ $< + lexer.cc: lexer.ll flex -o lexer.cc $< Modified: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/config.h.in 2008-06-06 17:58:53 UTC (rev 182) @@ -3,6 +3,9 @@ /* Define if you have the iconv() function. */ #undef HAVE_ICONV +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET @@ -21,6 +24,30 @@ /* Define to 1 if you have the `regex' library (-lregex). */ #undef HAVE_LIBREGEX +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + /* Define to the name of the host system. */ #undef HOST @@ -41,3 +68,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION + +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/configure 2008-06-06 17:58:53 UTC (rev 182) @@ -576,6 +576,42 @@ PACKAGE_STRING='pure 0.3' PACKAGE_BUGREPORT='' +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME @@ -623,6 +659,7 @@ host_os RDYNAMIC DLLEXT +AUXLIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA @@ -633,10 +670,13 @@ ac_ct_CXX EXEEXT OBJEXT -SHARED CC CFLAGS ac_ct_CC +CPP +GREP +EGREP +SHARED LIBICONV LIBOBJS LTLIBOBJS' @@ -651,7 +691,8 @@ CPPFLAGS CCC CC -CFLAGS' +CFLAGS +CPP' # Initialize some variables set by options. @@ -1230,6 +1271,7 @@ --enable-debug enable the debug build --enable-debug2 enable the maintenance build --disable-shared link the interpreter statically + --enable-warnings enable compiler warnings (-Wall) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1246,6 +1288,7 @@ you have headers in a nonstandard directory <include dir> CC C compiler command CFLAGS C compiler flags + CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1804,9 +1847,12 @@ RDYNAMIC= DLLEXT=".so" +AUX_LIBS= case "$host" in - *-*-mingw*) RDYNAMIC="-rdynamic"; LIBS="$LIBS -limagehlp -lpsapi"; - LDFLAGS="-Wl,--enable-auto-import"; DLLEXT=".dll";; + *-*-mingw*) RDYNAMIC="-rdynamic"; DLLEXT=".dll"; + AUXLIBS="-DLIBGLOB='\"libglob.dll\"' -DLIBREGEX='\"libgnurx-0.dll\"'"; + LIBS="$LIBS -limagehlp -lpsapi"; + LDFLAGS="-Wl,--enable-auto-import";; *-*-linux*) RDYNAMIC="-rdynamic";; *-*-freebsd*) RDYNAMIC="-rdynamic";; *-*-darwin*) DLLEXT=".dylib";; @@ -1814,6 +1860,7 @@ esac + # 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: @@ -2501,36 +2548,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Check whether --enable-release was given. -if test "${enable_release+set}" = set; then - enableval=$enable_release; case "${enableval}" in - yes) CPPFLAGS="-DNDEBUG -DDEBUG=0"; CXXFLAGS="-O3" ;; - esac -fi - -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then - enableval=$enable_debug; case "${enableval}" in - yes) CXXFLAGS="-g" ;; - esac -fi - -# Check whether --enable-debug2 was given. -if test "${enable_debug2+set}" = set; then - enableval=$enable_debug2; case "${enableval}" in - yes) CPPFLAGS="-DDEBUG=2"; CXXFLAGS="-g" ;; - esac -fi - -SHARED=yes -# Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then - enableval=$enable_shared; case "${enableval}" in - no) LDFLAGS="$LDFLAGS $RDYNAMIC"; SHARED=no ;; - esac -fi - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3208,45 +3225,611 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -{ echo "$as_me:$LINENO: checking for __gmpz_init in -lgmp" >&5 -echo $ECHO_N "checking for __gmpz_init in -lgmp... $ECHO_C" >&6; } -if test "${ac_cv_lib_gmp___gmpz_init+set}" = set; then + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent 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 <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 nonexistent 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 <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgmp $LIBS" -cat >conftest.$ac_ext <<_ACEOF + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_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_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ 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 <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char __gmpz_init (); int main () { -return __gmpz_init (); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 <string.h> + +_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 <stdlib.h> + +_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 <ctype.h> +#include <stdlib.h> +#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)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_var+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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 @@ -3254,69 +3837,158 @@ (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_gmp___gmpz_init=yes + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_gmp___gmpz_init=no + eval "$as_ac_Header=no" fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_gmp___gmpz_init" >&5 -echo "${ECHO_T}$ac_cv_lib_gmp___gmpz_init" >&6; } -if test $ac_cv_lib_gmp___gmpz_init = yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGMP 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - LIBS="-lgmp $LIBS" +fi +done + + +{ echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6; } +if test "${ac_cv_type_void_p+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 +typedef void * ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_void_p=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6; } -{ 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 +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lreadline $LIBS" + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. 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 + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char readline (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + 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 + typedef void * ac__type_sizeof_; int main () { -return readline (); +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -3325,39 +3997,320 @@ (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_readline_readline=yes + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_readline_readline=no + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + 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 + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + 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 + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 - LIBS="-lreadline $LIBS" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_lo=`expr '(' $ac_mid ')' + 1` fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi ;; +esac +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 + typedef void * ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ -{ echo "$as_me:$LINENO: checking for iconv in -liconv" >&5 -echo $ECHO_N "checking for iconv in -liconv... $ECHO_C" >&6; } -if test "${ac_cv_lib_iconv_iconv+set}" = set; then + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=`cat conftest.val` +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 ) +if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + +# Check whether --enable-release was given. +if test "${enable_release+set}" = set; then + enableval=$enable_release; case "${enableval}" in + yes) CPPFLAGS="-DNDEBUG -DDEBUG=0"; CXXFLAGS="-O3" ;; + esac +fi + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then + enableval=$enable_debug; case "${enableval}" in + yes) CXXFLAGS="-g" ;; + esac +fi + +# Check whether --enable-debug2 was given. +if test "${enable_debug2+set}" = set; then + enableval=$enable_debug2; case "${enableval}" in + yes) CPPFLAGS="-DDEBUG=2"; CXXFLAGS="-g" ;; + esac +fi + +SHARED=yes +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; case "${enableval}" in + no) LDFLAGS="$LDFLAGS $RDYNAMIC"; SHARED=no ;; + esac +fi + + +# Check whether --enable-warnings was given. +if test "${enable_warnings+set}" = set; then + enableval=$enable_warnings; case "${enableval}" in + yes) CXXFLAGS="$CXXFLAGS -Wall" ;; + esac +fi + + +{ echo "$as_me:$LINENO: checking for __gmpz_init in -lgmp" >&5 +echo $ECHO_N "checking for __gmpz_init in -lgmp... $ECHO_C" >&6; } +if test "${ac_cv_lib_gmp___gmpz_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-liconv $LIBS" +LIBS="-lgmp $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3371,11 +4324,11 @@ #ifdef __cplusplus extern "C" #endif -char iconv (); +char __gmpz_init (); int main () { -return iconv (); +return __gmpz_init (); ; return 0; } @@ -3398,38 +4351,37 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_iconv_iconv=yes + ac_cv_lib_gmp___gmpz_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_iconv_iconv=no + ac_cv_lib_gmp___gmpz_init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv" >&5 -echo "${ECHO_T}$ac_cv_lib_iconv_iconv" >&6; } -if test $ac_cv_lib_iconv_iconv = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gmp___gmpz_init" >&5 +echo "${ECHO_T}$ac_cv_lib_gmp___gmpz_init" >&6; } +if test $ac_cv_lib_gmp___gmpz_init = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_LIBICONV 1 +#define HAVE_LIBGMP 1 _ACEOF - LIBS="-liconv $LIBS" + LIBS="-lgmp $LIBS" fi -if test $ac_cv_lib_iconv_iconv = no; then -{ echo "$as_me:$LINENO: checking for libiconv in -liconv" >&5 -echo $ECHO_N "checking for libiconv in -liconv... $ECHO_C" >&6; } -if test "${ac_cv_lib_iconv_libiconv+set}" = set; then +{ 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="-liconv $LIBS" +LIBS="-lreadline $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3443,11 +4395,11 @@ #ifdef __cplusplus extern "C" #endif -char libiconv (); +char readline (); int main () { -return libiconv (); +return readline (); ; return 0; } @@ -3470,38 +4422,37 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_iconv_libiconv=yes + ac_cv_lib_readline_readline=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_iconv_libiconv=no + ac_cv_lib_readline_readline=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv" >&5 -echo "${ECHO_T}$ac_cv_lib_iconv_libiconv" >&6; } -if test $ac_cv_lib_iconv_libiconv = yes; then +{ 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_LIBICONV 1 +#define HAVE_LIBREADLINE 1 _ACEOF - LIBS="-liconv $LIBS" + LIBS="-lreadline $LIBS" fi -fi -{ echo "$as_me:$LINENO: checking for glob in -lglob" >&5 -echo $ECHO_N "checking for glob in -lglob... $ECHO_C" >&6; } -if test "${ac_cv_lib_glob_glob+set}" = set; then +{ echo "$as_me:$LINENO: checking for libiconv in -liconv" >&5 +echo $ECHO_N "checking for libiconv in -liconv... $ECHO_C" >&6; } +if test "${ac_cv_lib_iconv_libiconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lglob $LIBS" +LIBS="-liconv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3515,11 +4466,11 @@ #ifdef __cplusplus extern "C" #endif -char glob (); +char libiconv (); int main () { -return glob (); +return libiconv (); ; return 0; } @@ -3542,38 +4493,38 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_glob_glob=yes + ac_cv_lib_iconv_libiconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_glob_glob=no + ac_cv_lib_iconv_libiconv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_glob_glob" >&5 -echo "${ECHO_T}$ac_cv_lib_glob_glob" >&6; } -if test $ac_cv_lib_glob_glob = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_libiconv" >&6; } +if test $ac_cv_lib_iconv_libiconv = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGLOB 1 +#define HAVE_LIBICONV 1 _ACEOF - LIBS="-lglob $LIBS" + LIBS="-liconv $LIBS" fi -if test $ac_cv_lib_glob_glob = no; then +if test $ac_cv_lib_iconv_libiconv = no; then -{ echo "$as_me:$LINENO: checking for xxglob in -lglob" >&5 -echo $ECHO_N "checking for xxglob in -lglob... $ECHO_C" >&6; } -if test "${ac_cv_lib_glob_xxglob+set}" = set; then +{ echo "$as_me:$LINENO: checking for iconv in -liconv" >&5 +echo $ECHO_N "checking for iconv in -liconv... $ECHO_C" >&6; } +if test "${ac_cv_lib_iconv_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lglob $LIBS" +LIBS="-liconv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3587,11 +4538,11 @@ #ifdef __cplusplus extern "C" #endif -char xxglob (); +char iconv (); int main () { -return xxglob (); +return iconv (); ; return 0; } @@ -3614,38 +4565,38 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_glob_xxglob=yes + ac_cv_lib_iconv_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_glob_xxglob=no + ac_cv_lib_iconv_iconv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_glob_xxglob" >&5 -echo "${ECHO_T}$ac_cv_lib_glob_xxglob" >&6; } -if test $ac_cv_lib_glob_xxglob = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_iconv" >&6; } +if test $ac_cv_lib_iconv_iconv = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGLOB 1 +#define HAVE_LIBICONV 1 _ACEOF - LIBS="-lglob $LIBS" + LIBS="-liconv $LIBS" fi fi -{ echo "$as_me:$LINENO: checking for regcomp in -lregex" >&5 -echo $ECHO_N "checking for regcomp in -lregex... $ECHO_C" >&6; } -if test "${ac_cv_lib_regex_regcomp+set}" = set; then +{ echo "$as_me:$LINENO: checking for glob in -lglob" >&5 +echo $ECHO_N "checking for glob in -lglob... $ECHO_C" >&6; } +if test "${ac_cv_lib_glob_glob+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lregex $LIBS" +LIBS="-lglob $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3659,11 +4610,11 @@ #ifdef __cplusplus extern "C" #endif -char regcomp (); +char glob (); int main () { -return regcomp (); +return glob (); ; return 0; } @@ -3686,34 +4637,33 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_regex_regcomp=yes + ac_cv_lib_glob_glob=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_regex_regcomp=no + ac_cv_lib_glob_glob=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_regex_regcomp" >&5 -echo "${ECHO_T}$ac_cv_lib_regex_regcomp" >&6; } -if test $ac_cv_lib_regex_regcomp = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_glob_glob" >&5 +echo "${ECHO_T}$ac_cv_lib_glob_glob" >&6; } +if test $ac_cv_lib_glob_glob = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_LIBREGEX 1 +#define HAVE_LIBGLOB 1 _ACEOF - LIBS="-lregex $LIBS" + LIBS="-lglob $LIBS" fi -if test $ac_cv_lib_regex_regcomp = no; then -{ echo "$as_me:$LINENO: checking for xxregcomp in -lregex" >&5 -echo $ECHO_N "checking for xxregcomp in -lregex... $ECHO_C" >&6; } -if test "${ac_cv_lib_regex_xxregcomp+set}" = set; then +{ echo "$as_me:$LINENO: checking for regcomp in -lregex" >&5 +echo $ECHO_N "checking for regcomp in -lregex... $ECHO_C" >&6; } +if test "${ac_cv_lib_regex_regcomp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -3731,11 +4681,11 @@ #ifdef __cplusplus extern "C" #endif -char xxregcomp (); +char regcomp (); int main () { -return xxregcomp (); +return regcomp (); ; return 0; } @@ -3758,21 +4708,21 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_regex_xxregcomp=yes + ac_cv_lib_regex_regcomp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_regex_xxregcomp=no + ac_cv_lib_regex_regcomp=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_regex_xxregcomp" >&5 -echo "${ECHO_T}$ac_cv_lib_regex_xxregcomp" >&6; } -if test $ac_cv_lib_regex_xxregcomp = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_regex_regcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_regex_regcomp" >&6; } +if test $ac_cv_lib_regex_regcomp = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBREGEX 1 _ACEOF @@ -3781,7 +4731,6 @@ fi -fi am_cv_lib_iconv_ldpath= @@ -4718,6 +5667,7 @@ host_os!$host_os$ac_delim RDYNAMIC!$RDYNAMIC$ac_delim DLLEXT!$DLLEXT$ac_delim +AUXLIBS!$AUXLIBS$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim @@ -4728,16 +5678,19 @@ ac_ct_CXX!$ac_ct_CXX$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim -SHARED!$SHARED$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +SHARED!$SHARED$ac_delim LIBICONV!$LIBICONV$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 64; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/configure.ac 2008-06-06 17:58:53 UTC (rev 182) @@ -11,9 +11,12 @@ dnl Figure out extra build flags and filename extensions for various systems. RDYNAMIC= DLLEXT=".so" +AUX_LIBS= case "$host" in - *-*-mingw*) RDYNAMIC="-rdynamic"; LIBS="$LIBS -limagehlp -lpsapi"; - LDFLAGS="-Wl,--enable-auto-import"; DLLEXT=".dll";; + *-*-mingw*) RDYNAMIC="-rdynamic"; DLLEXT=".dll"; + AUXLIBS="-DLIBGLOB='\"libglob.dll\"' -DLIBREGEX='\"libgnurx-0.dll\"'"; + LIBS="$LIBS -limagehlp -lpsapi"; + LDFLAGS="-Wl,--enable-auto-import";; *-*-linux*) RDYNAMIC="-rdynamic";; *-*-freebsd*) RDYNAMIC="-rdynamic";; *-*-darwin*) DLLEXT=".dylib";; @@ -21,9 +24,12 @@ esac AC_SUBST(RDYNAMIC) AC_SUBST(DLLEXT) +AC_SUBST(AUXLIBS) dnl Check for programs. AC_PROG_INSTALL AC_PROG_CXX +dnl Determine pointer sizes. This will be 8 on 64 bit systems. +AC_CHECK_SIZEOF(void *) dnl Parse --enable options. AC_ARG_ENABLE(release, [ --enable-release enable the release build], @@ -47,22 +53,24 @@ no) LDFLAGS="$LDFLAGS $RDYNAMIC"; SHARED=no ;; esac]) AC_SUBST(SHARED) +AC_ARG_ENABLE(warnings, + [ --enable-warnings enable compiler warnings (-Wall)], + [case "${enableval}" in + yes) CXXFLAGS="$CXXFLAGS -Wall" ;; + esac]) dnl Check for libraries. AC_CHECK_LIB(gmp, __gmpz_init) AC_CHECK_LIB(readline, readline) -dnl On some systems these are in separate libraries, and may have other names. -AC_CHECK_LIB(iconv, iconv) -if test $ac_cv_lib_iconv_iconv = no; then - AC_CHECK_LIB(iconv, libiconv) +dnl On some systems iconv is in a separate library, and may actually be named +dnl libiconv. +AC_CHECK_LIB(iconv, libiconv) +if test $ac_cv_lib_iconv_libiconv = no; then + AC_CHECK_LIB(iconv, iconv) fi +dnl On non-POSIX systems like Windows, we have to get the glob and regex +dnl functions from separate libraries, too. AC_CHECK_LIB(glob, glob) -if test $ac_cv_lib_glob_glob = no; then - AC_CHECK_LIB(glob, xxglob) -fi AC_CHECK_LIB(regex, regcomp) -if test $ac_cv_lib_regex_regcomp = no; then - AC_CHECK_LIB(regex, xxregcomp) -fi dnl iconv and nl_langinfo need special treatment (macros by Bruno Haible). AM_ICONV AM_LANGINFO_CODESET Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/interpreter.cc 2008-06-06 17:58:53 UTC (rev 182) @@ -11,6 +11,8 @@ #include <llvm/System/DynamicLibrary.h> #include <llvm/Transforms/Utils/BasicBlockUtils.h> +#include "config.h" + uint8_t interpreter::g_verbose = 0; bool interpreter::g_interactive = false; interpreter* interpreter::g_interp = 0; @@ -61,7 +63,17 @@ if (!g_interp) { g_interp = this; stackdir = c_stack_dir(); - llvm::sys::DynamicLibrary::LoadLibraryPermanently("libpure", 0); + // Preload some auxiliary dlls. First load the Pure library if we built it. +#ifdef LIBPURE + llvm::sys::DynamicLibrary::LoadLibraryPermanently(LIBPURE, 0); +#endif + // Additional stuff to be loaded on some systems (e.g., Windows). +#ifdef LIBGLOB + llvm::sys::DynamicLibrary::LoadLibraryPermanently(LIBGLOB, 0); +#endif +#ifdef LIBREGEX + llvm::sys::DynamicLibrary::LoadLibraryPermanently(LIBREGEX, 0); +#endif } sstk_sz = 0; sstk_cap = 0x10000; // 64K Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/runtime.cc 2008-06-06 17:58:53 UTC (rev 182) @@ -10,6 +10,7 @@ #include <iostream> #include <sstream> +#include "config.h" #include "funcall.h" // Hook to report stack overflows and other kinds of hard errors. @@ -1068,9 +1069,13 @@ case EXPR::INT: return x; case EXPR::BIGINT: return pure_int(mpz_get_ui(x->data.z)); case EXPR::DBL: return pure_int((int32_t)x->data.d); +#if SIZEOF_VOID_P==8 // Must cast to 64 bit here first, since on 64 bit systems g++ gives an // error when directly casting a 64 bit pointer to a 32 bit integer. case EXPR::PTR: return pure_int((uint32_t)(uint64_t)x->data.p); +#else + case EXPR::PTR: return pure_int((uint32_t)x->data.p); +#endif default: return 0; } } @@ -1097,13 +1102,19 @@ case EXPR::INT: return pure_pointer((void*)x->data.i); case EXPR::BIGINT: if (sizeof(mp_limb_t) == 8) +#if SIZEOF_VOID_P==8 return pure_pointer((void*)mpz_getlimbn(x->data.z, 0)); - else if (sizeof(void*) == 4) - return pure_pointer((void*)mpz_get_ui(x->data.z)); +#else + return pure_pointer((void*)(uint32_t)mpz_getlimbn(x->data.z, 0)); +#endif else { +#if SIZEOF_VOID_P==8 uint64_t u = mpz_getlimbn(x->data.z, 0) + (((uint64_t)mpz_getlimbn(x->data.z, 1))<<32); return pure_pointer((void*)u); +#else + return pure_pointer((void*)mpz_get_ui(x->data.z)); +#endif } default: return 0; } @@ -1113,21 +1124,24 @@ { if (sizeof(mp_limb_t) == 8) { // In this case the pointer value ought to fit into a single limb. +#if SIZEOF_VOID_P==8 limb_t u[1] = { (uint64_t)p }; +#else + limb_t u[1] = { (uint64_t)(uint32_t)p }; +#endif return pure_bigint(1, u); } // 4 byte limbs. - if (sizeof(void*) == 4) { - // 4 byte pointers. Note that we still cast to 64 bit first, since - // otherwise the code will give an error on 64 bit systems. - limb_t u[1] = { (uint32_t)(uint64_t)p }; - return pure_bigint(1, u); - } else { - // 8 byte pointers, put least significant word in the first limb. - assert(sizeof(void*) == 8); - limb_t u[2] = { (uint32_t)(uint64_t)p, (uint32_t)(((uint64_t)p)>>32) }; - return pure_bigint(2, u); - } +#if SIZEOF_VOID_P==8 + // 8 byte pointers, put least significant word in the first limb. + assert(sizeof(void*) == 8); + limb_t u[2] = { (uint32_t)(uint64_t)p, (uint32_t)(((uint64_t)p)>>32) }; + return pure_bigint(2, u); +#else + // 4 byte pointers. + limb_t u[1] = { (uint32_t)p }; + return pure_bigint(1, u); +#endif } extern "C" @@ -1604,7 +1618,21 @@ errno = value; } +#ifdef __MINGW32__ extern "C" +FILE *popen(const char *command, const char *type) +{ + return _popen(command, type); +} + +extern "C" +int pclose(FILE *stream) +{ + return _pclose(stream); +} +#endif + +extern "C" int pure_fprintf(FILE *fp, const char *format) { return fprintf(fp, format); Modified: pure/trunk/runtime.h =================================================================== --- pure/trunk/runtime.h 2008-06-06 17:12:35 UTC (rev 181) +++ pure/trunk/runtime.h 2008-06-06 17:58:53 UTC (rev 182) @@ -324,6 +324,13 @@ int pure_errno(void); void pure_set_errno(int value); +#ifdef __MINGW32__ +/* Windows compatibility. */ + +FILE *popen(const char *command, const char *type); +int pclose(FILE *stream); +#endif + /* printf/scanf support. Since we don't support calling C vararg functions from Pure right now, these little wrappers are provided to process at most one value at a time. It is the responsibility of the caller that the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-07 23:42:01
|
Revision: 192 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=192&view=rev Author: agraef Date: 2008-06-07 16:42:04 -0700 (Sat, 07 Jun 2008) Log Message: ----------- Final touches for 0.3 release. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/INSTALL pure/trunk/README pure/trunk/pure.1 Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-06-07 06:36:38 UTC (rev 191) +++ pure/trunk/ChangeLog 2008-06-07 23:42:04 UTC (rev 192) @@ -1,5 +1,7 @@ 2008-06-06 Albert Graef <Dr....@t-...> + * 0.3 release. + * configure.ac, etc.: Added autoconf support. Various fixes for 64 bit and Windows compatibility. See the INSTALL file for updated installation instructions. Modified: pure/trunk/INSTALL =================================================================== --- pure/trunk/INSTALL 2008-06-07 06:36:38 UTC (rev 191) +++ pure/trunk/INSTALL 2008-06-07 23:42:04 UTC (rev 192) @@ -61,8 +61,8 @@ Note the configure flags; these are for an optimized (non-debug) build and disable all compilation targets but the one for your system. (You might wish to omit the --enable-targets=host-only if you want to use other LLVM -applications and offering cross-compilation capabilities.) To do a debug build -of LLVM, simply leave away all the extra configure parameters (except possibly +applications offering cross-compilation capabilities.) To do a debug build of +LLVM, simply leave away all the extra configure parameters (except possibly --enable-targets=host-only). Note, however, that this will have an impact on the speed of the Pure compiler. @@ -99,7 +99,7 @@ Run Pure interactively as: $ pure -Pure 0.3 Copyright (c) 2008 by Albert Graef +Pure 0.3 (i686-pc-linux-gnu) Copyright (c) 2008 by Albert Graef This program is free software distributed under the GNU Public License (GPL V3 or later). Please see the COPYING file for details. Loaded prelude from /usr/local/lib/pure/prelude.pure. @@ -147,7 +147,8 @@ $ svn co http://pure-lang.svn.sourceforge.net/svnroot/pure-lang pure-lang This step needs to be done only once; once you've checked out your working -copy, you can update it to the latest revision by running 'svn up'. +copy, you can update it to the latest revision at any time by running +'svn up'. STEP 5': Configure, build and install Pure: @@ -325,10 +326,10 @@ ====== ===== Pure is known to work on recent Linux and Mac OSX versions under x86, x86-64 -and ppc, as well as on MS Windows XP, but there are a few system-specific -quirks which are discussed below. (Please also see the CAVEATS AND NOTES -section of the manual page for information on other known limitations of the -current implementation.) +and ppc, as well as on MS Windows, but there are a few system-specific quirks +which are discussed below. (Please also see the CAVEATS AND NOTES section of +the manual page for information on other known limitations of the current +implementation.) ALL PLATFORMS --- --------- @@ -392,14 +393,19 @@ Thanks to Jiri Spitz' perseverance, tireless testing and bug reports, the latest sources compile and run fine on Windows, using the Mingw port of the -GNU C++ compiler and the MSys environment from http://www.mingw.org/. (Cygwin -from http://www.cygwin.com/ probably works as well, but this has not been -tested.) Just do the usual './configure && make && make install'. You'll need -LLVM, of course (which builds with Mingw just fine), and a few additional -libraries for which headers and precompiled binaries are available from the -Pure website (http://pure-lang.sf.net/). +GNU C++ compiler and the MSYS environment from http://www.mingw.org/. Just do +the usual './configure && make && make install'. You'll need LLVM, of course +(which builds with Mingw just fine), and a few additional libraries for which +headers and precompiled binaries are available from the Pure website +(http://pure-lang.sf.net/). +A binary package in msi format is available as well (see "Downloads" on the +Pure website), which includes all required libraries. The package also +includes some shortcuts which will be installed in your Program menu, allowing +you to run the Pure interpreter either in a normal Windows command window or +the MSYS shell available from http://www.mingw.org/. + June 2008 Albert Graef <Dr.Graef at t-online.de> Eddie Rucker <erucker at bmc.edu> Modified: pure/trunk/README =================================================================== --- pure/trunk/README 2008-06-07 06:36:38 UTC (rev 191) +++ pure/trunk/README 2008-06-07 23:42:04 UTC (rev 192) @@ -15,7 +15,8 @@ WHERE TO GET IT -You can find tarballs and the svn repository at http://pure-lang.sf.net. +You can find tarballs, binary packages and the svn repository at +http://pure-lang.sf.net. LICENSE Modified: pure/trunk/pure.1 =================================================================== --- pure/trunk/pure.1 2008-06-07 06:36:38 UTC (rev 191) +++ pure/trunk/pure.1 2008-06-07 23:42:04 UTC (rev 192) @@ -198,7 +198,7 @@ .PP Expressions consist of the following elements: .TP -.B Constants: \fR4711, 4711G, 1.2e-3, \(dqHello,\ world!\en\(dq +.B Constants: \fR4711, 4711L, 1.2e-3, \(dqHello,\ world!\en\(dq The usual C'ish notations for integers (decimal, hexadecimal, octal), floating point values and double-quoted strings are all provided, although the Pure syntax differs in some minor ways, as discussed in the following. First, there @@ -491,7 +491,7 @@ to handle these kinds of exceptions just like any other. For instance: .sp .nf -> fact n = if n>0 then n*fact(n-1) else 1; +> fact n = \fBif\fP n>0 \fBthen\fP n*fact(n-1) \fBelse\fP 1; > catch error (fact foo); error failed_cond > catch error (fact 100000); @@ -604,7 +604,7 @@ declaration into a script): .sp .nf -> extern double sin(double); +> \fBextern\fP double sin(double); > sin 0.3; 0.29552020666134 .fi @@ -613,7 +613,7 @@ e.g.: .sp .nf -extern double sin(double x); +\fBextern\fP double sin(double x); .fi .sp Parameter names in prototypes only serve informational purposes and are for @@ -678,7 +678,7 @@ declaration with a clause of the form ``= \fIalias\fP''. For instance: .sp .nf -> extern double sin(double) = c_sin; +> \fBextern\fP double sin(double) = c_sin; > sin x::double = c_sin x; > sin x::int = c_sin (double x); > sin 0.3; sin 0; @@ -687,12 +687,12 @@ .fi .PP External C functions are resolved by the LLVM runtime, which first looks for -the symbol in the interpreter executable. Since the interpreter links in its -own runtime support as well as all of the standard C library, these functions -are ready to be used in Pure programs. Other functions can be made available -by including them in the runtime, or by linking the interpreter against the -corresponding modules. Or, better yet, you can just ``dlopen'' shared -libraries at runtime with a special form of the +the symbol in the C library and Pure's runtime library (or the interpreter +executable, if the interpreter was linked statically). Thus all C library and +Pure runtime functions are readily available in Pure programs. Other functions +can be provided by including them in the runtime, or by linking the +interpreter against the corresponding modules. Or, better yet, you can just +``dlopen'' shared libraries at runtime with a special form of the .B using clause: .sp @@ -713,9 +713,9 @@ .PP Shared libraries opened with \fBusing\fP clauses are searched for on the usual system linker path (\fBLD_LIBRARY_PATH\fP on Linux). The necessary filename -suffix (\fB.so\fP on Linux) will also be supplied automatically. You can also -specify a full pathname for the library if you prefer that. If a library file -cannot be found, or if an +suffix (e.g., \fB.so\fP on Linux or \fB.dll\fP on Windows) will also be +supplied automatically. You can also specify a full pathname for the library +if you prefer that. If a library file cannot be found, or if an .B extern declaration names a function symbol which cannot be resolved, an appropriate error message is printed. @@ -886,7 +886,9 @@ Output is piped through the .BR more (1) program to make it easier to read, as some of the options (in particular, -.BR -c and -d ) +.B -c +and +.BR -d ) may produce excessive amounts of information. .PP For instance, to list all definitions in all loaded scripts (including the @@ -1009,8 +1011,8 @@ rules, but \fIbelow\fP our previous `foo (x:xs) = x*foo xs;' equation entered at the same level. As you can see, we have now effectively replaced our original definition of `foo' with a version that calculates list products -instead of sums, but of course we can easily go back to the previous level to -restore the previous definition: +instead of sums, but of course we can easily go back one level to restore the +previous definition: .sp .nf > \fBclear\fP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-09 23:02:00
|
Revision: 199 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=199&view=rev Author: agraef Date: 2008-06-09 16:02:05 -0700 (Mon, 09 Jun 2008) Log Message: ----------- Add necessary configure magic to get alloca. Modified Paths: -------------- pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac pure/trunk/runtime.cc Modified: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in 2008-06-09 22:40:23 UTC (rev 198) +++ pure/trunk/config.h.in 2008-06-09 23:02:05 UTC (rev 199) @@ -1,5 +1,20 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + /* Define if you have the iconv() function. */ #undef HAVE_ICONV @@ -72,5 +87,13 @@ /* The size of `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-09 22:40:23 UTC (rev 198) +++ pure/trunk/configure 2008-06-09 23:02:05 UTC (rev 199) @@ -678,6 +678,7 @@ EGREP SHARED LIBICONV +ALLOCA LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -5002,6 +5003,365 @@ fi +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } +if test "${ac_cv_working_alloca_h+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 <alloca.h> +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_working_alloca_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_working_alloca_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA_H 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6; } +if test "${ac_cv_func_alloca_works+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. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_alloca_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_alloca_works=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA 1 +_ACEOF + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +cat >>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; } +if test "${ac_cv_os_cray+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. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+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 $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; } +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +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 +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + return find_stack_direction () < 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_stack_direction=1 +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_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; } + +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -5686,11 +6046,12 @@ EGREP!$EGREP$ac_delim SHARED!$SHARED$ac_delim LIBICONV!$LIBICONV$ac_delim +ALLOCA!$ALLOCA$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-09 22:40:23 UTC (rev 198) +++ pure/trunk/configure.ac 2008-06-09 23:02:05 UTC (rev 199) @@ -74,6 +74,8 @@ dnl iconv and nl_langinfo need special treatment (macros by Bruno Haible). AM_ICONV AM_LANGINFO_CODESET +dnl Determine how to get alloca. +AC_FUNC_ALLOCA AC_CONFIG_FILES([Makefile]) AC_OUTPUT Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-06-09 22:40:23 UTC (rev 198) +++ pure/trunk/runtime.cc 2008-06-09 23:02:05 UTC (rev 199) @@ -1,4 +1,19 @@ +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + #include "runtime.h" #include "expr.hh" #include "interpreter.hh" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-13 08:32:02
|
Revision: 201 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=201&view=rev Author: agraef Date: 2008-06-13 01:32:03 -0700 (Fri, 13 Jun 2008) Log Message: ----------- Add configure magic to get -fPIC on Linux x86-64. Modified Paths: -------------- pure/trunk/Makefile.in pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in 2008-06-09 23:11:12 UTC (rev 200) +++ pure/trunk/Makefile.in 2008-06-13 08:32:03 UTC (rev 201) @@ -53,7 +53,7 @@ LLVM_FLAGS = `llvm-config --cppflags` LLVM_LIBS = `llvm-config --ldflags --libs core jit native` -CPPFLAGS = @CPPFLAGS@ $(LLVM_FLAGS) +CPPFLAGS = @CPPFLAGS@ CXXFLAGS = @CXXFLAGS@ # Pure library name. Currently we use a simple versioning scheme, which @@ -68,13 +68,21 @@ libpurelnk = lib$(libpure_base)$(DLL) LIBPURE = -l$(libpure_vers) -# Whether to build the Pure library. If this is set to anything but "yes", the -# interpreter is linked statically and no separate runtime library is +# Whether to build the Pure runtime library. If this is set to anything but +# "yes", the interpreter is linked statically and no separate library is # produced. This is necessary on some systems where LLVM cannot be linked in # dynamically. SHARED = @SHARED@ +# On some systems -fPIC is needed for code linked as a shared library. + +ifeq ($(SHARED), yes) +PIC = @PIC@ +else +PIC = +endif + # Auxiliary libraries to be loaded at runtime. Usually this is just libpure # (when built), but on some systems we have to load additional dlls to resolve # some library functions. @@ -119,11 +127,14 @@ ln -sf $(libpure) $(libpurelnk) pure.o: pure.cc - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -DPURELIB='"$(libdir)/pure"' -c -o $@ $< + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LLVM_FLAGS) -DPURELIB='"$(libdir)/pure"' -c -o $@ $< interpreter.o: interpreter.cc - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(AUXLIBS) -c -o $@ $< + $(CXX) $(CXXFLAGS) $(PIC) $(CPPFLAGS) $(LLVM_FLAGS) $(AUXLIBS) -c -o $@ $< +%.o: %.cc + $(CXX) $(CXXFLAGS) $(PIC) $(CPPFLAGS) $(LLVM_FLAGS) -c -o $@ $< + lexer.cc: lexer.ll flex -o lexer.cc $< Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-09 23:11:12 UTC (rev 200) +++ pure/trunk/configure 2008-06-13 08:32:03 UTC (rev 201) @@ -657,6 +657,7 @@ host_cpu host_vendor host_os +PIC RDYNAMIC DLLEXT AUXLIBS @@ -1846,6 +1847,7 @@ _ACEOF +PIC= RDYNAMIC= DLLEXT=".so" AUX_LIBS= @@ -1854,6 +1856,7 @@ AUXLIBS="-DLIBGLOB='\"libglob.dll\"' -DLIBREGEX='\"libgnurx-0.dll\"'"; LIBS="$LIBS -limagehlp -lpsapi"; LDFLAGS="-Wl,--enable-auto-import";; + x86_64-*-linux*) RDYNAMIC="-rdynamic"; PIC="-fPIC";; *-*-linux*) RDYNAMIC="-rdynamic";; *-*-freebsd*) RDYNAMIC="-rdynamic";; *-*-darwin*) DLLEXT=".dylib";; @@ -1862,6 +1865,7 @@ + # 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: @@ -6025,6 +6029,7 @@ host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim +PIC!$PIC$ac_delim RDYNAMIC!$RDYNAMIC$ac_delim DLLEXT!$DLLEXT$ac_delim AUXLIBS!$AUXLIBS$ac_delim @@ -6051,7 +6056,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 70; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-09 23:11:12 UTC (rev 200) +++ pure/trunk/configure.ac 2008-06-13 08:32:03 UTC (rev 201) @@ -9,6 +9,9 @@ AC_DEFINE_UNQUOTED(HOST, "${host}", [Define to the name of the host system.]) AC_SUBST(host) dnl Figure out extra build flags and filename extensions for various systems. +dnl XXXFIXME: -fPIC is acurrently assumed for Linux x86-64 only. There might +dnl be other Unix systems which need this. +PIC= RDYNAMIC= DLLEXT=".so" AUX_LIBS= @@ -17,11 +20,13 @@ AUXLIBS="-DLIBGLOB='\"libglob.dll\"' -DLIBREGEX='\"libgnurx-0.dll\"'"; LIBS="$LIBS -limagehlp -lpsapi"; LDFLAGS="-Wl,--enable-auto-import";; + x86_64-*-linux*) RDYNAMIC="-rdynamic"; PIC="-fPIC";; *-*-linux*) RDYNAMIC="-rdynamic";; *-*-freebsd*) RDYNAMIC="-rdynamic";; *-*-darwin*) DLLEXT=".dylib";; hppa*-hp-hpux*) DLLEXT=".sl";; esac +AC_SUBST(PIC) AC_SUBST(RDYNAMIC) AC_SUBST(DLLEXT) AC_SUBST(AUXLIBS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-13 09:34:46
|
Revision: 203 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=203&view=rev Author: agraef Date: 2008-06-13 02:34:55 -0700 (Fri, 13 Jun 2008) Log Message: ----------- Rename SHARED, eliminate LIBPURE variable. Modified Paths: -------------- pure/trunk/Makefile.in pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/Makefile.in =================================================================== --- pure/trunk/Makefile.in 2008-06-13 09:18:22 UTC (rev 202) +++ pure/trunk/Makefile.in 2008-06-13 09:34:55 UTC (rev 203) @@ -66,18 +66,17 @@ libpure = lib$(libpure_vers)$(DLL) libpurelnk = lib$(libpure_base)$(DLL) -LIBPURE = -l$(libpure_vers) # Whether to build the Pure runtime library. If this is set to anything but # "yes", the interpreter is linked statically and no separate library is # produced. This is necessary on some systems where LLVM cannot be linked in # dynamically. -SHARED = @SHARED@ +sharedlib = @sharedlib@ # On some systems -fPIC is needed for code linked as a shared library. -ifeq ($(SHARED), yes) +ifeq ($(sharedlib), yes) PIC = @PIC@ else PIC = @@ -87,7 +86,7 @@ # (when built), but on some systems we have to load additional dlls to resolve # some library functions. -ifeq ($(SHARED), yes) +ifeq ($(sharedlib), yes) AUXLIBS = -DLIBPURE='"$(libpure)"' @AUXLIBS@ else AUXLIBS = @AUXLIBS@ @@ -114,9 +113,9 @@ all: pure$(EXE) -ifeq ($(SHARED), yes) +ifeq ($(sharedlib), yes) pure$(EXE): pure.o $(libpure) - $(CXX) -o $@ $(LDFLAGS) pure.o -L. $(LIBPURE) $(LIBS) + $(CXX) -o $@ $(LDFLAGS) pure.o -L. -l$(libpure_vers) $(LIBS) else pure$(EXE): pure.o $(OBJECT) $(CXX) -o $@ $(LDFLAGS) pure.o $(OBJECT) $(LLVM_LIBS) $(LIBS) @@ -189,7 +188,7 @@ install: pure$(EXE) for x in $(addprefix $(DESTDIR), $(bindir) $(libdir)/pure $(man1dir)); do $(INSTALL) -d $$x; done $(INSTALL) pure$(EXE) $(DESTDIR)$(bindir)/pure$(EXE) -ifeq ($(SHARED), yes) +ifeq ($(sharedlib), yes) $(INSTALL) $(libpure) $(DESTDIR)$(libdir)/$(libpure) ln -sf $(libdir)/$(libpure) $(DESTDIR)$(libdir)/$(libpurelnk) endif Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-06-13 09:18:22 UTC (rev 202) +++ pure/trunk/configure 2008-06-13 09:34:55 UTC (rev 203) @@ -677,7 +677,7 @@ CPP GREP EGREP -SHARED +sharedlib LIBICONV ALLOCA LIBOBJS @@ -4292,11 +4292,11 @@ esac fi -SHARED=yes +sharedlib=yes # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; case "${enableval}" in - no) LDFLAGS="$LDFLAGS $RDYNAMIC"; SHARED=no ;; + no) LDFLAGS="$LDFLAGS $RDYNAMIC"; sharedlib=no ;; esac fi @@ -6049,7 +6049,7 @@ CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim -SHARED!$SHARED$ac_delim +sharedlib!$sharedlib$ac_delim LIBICONV!$LIBICONV$ac_delim ALLOCA!$ALLOCA$ac_delim LIBOBJS!$LIBOBJS$ac_delim @@ -6493,7 +6493,7 @@ Installation prefix: ${prefix} Compiler: $CXX $CXXFLAGS $CPPFLAGS Linker: $CXX $LDFLAGS $LIBS - Build libpure: $SHARED + Build libpure: $sharedlib Now run 'make' to build everything, and 'make install' to install this software on your system. To remove the installed software at a later @@ -6506,7 +6506,7 @@ Installation prefix: ${prefix} Compiler: $CXX $CXXFLAGS $CPPFLAGS Linker: $CXX $LDFLAGS $LIBS - Build libpure: $SHARED + Build libpure: $sharedlib Now run 'make' to build everything, and 'make install' to install this software on your system. To remove the installed software at a later Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-06-13 09:18:22 UTC (rev 202) +++ pure/trunk/configure.ac 2008-06-13 09:34:55 UTC (rev 203) @@ -51,13 +51,13 @@ [case "${enableval}" in yes) CPPFLAGS="-DDEBUG=2"; CXXFLAGS="-g" ;; esac]) -SHARED=yes +sharedlib=yes AC_ARG_ENABLE(shared, [ --disable-shared link the interpreter statically], [case "${enableval}" in - no) LDFLAGS="$LDFLAGS $RDYNAMIC"; SHARED=no ;; + no) LDFLAGS="$LDFLAGS $RDYNAMIC"; sharedlib=no ;; esac]) -AC_SUBST(SHARED) +AC_SUBST(sharedlib) AC_ARG_ENABLE(warnings, [ --enable-warnings enable compiler warnings (-Wall)], [case "${enableval}" in @@ -91,7 +91,7 @@ Installation prefix: ${prefix} Compiler: $CXX $CXXFLAGS $CPPFLAGS Linker: $CXX $LDFLAGS $LIBS - Build libpure: $SHARED + Build libpure: $sharedlib Now run 'make' to build everything, and 'make install' to install this software on your system. To remove the installed software at a later This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |