204 |
|
|
205 |
# AC_LANG_INT_SAVE(C)(PROLOGUE, EXPRESSION) |
# AC_LANG_INT_SAVE(C)(PROLOGUE, EXPRESSION) |
206 |
# ----------------------------------------- |
# ----------------------------------------- |
207 |
# We need `stdio.h' to open a `FILE', so the prologue defaults to the |
# We need `stdio.h' to open a `FILE' and `stdlib.h' for `exit'. |
208 |
# inclusion of `stdio.h'. |
# But we include them only after the EXPRESSION has been evaluated. |
209 |
m4_define([AC_LANG_INT_SAVE(C)], |
m4_define([AC_LANG_INT_SAVE(C)], |
210 |
[AC_LANG_PROGRAM([m4_default([$1], [@%:@include <stdio.h>])], |
[AC_LANG_PROGRAM([$1 |
211 |
[FILE *f = fopen ("conftest.val", "w"); |
unsigned long conftestval () { return $2; } |
212 |
if (!f) |
@%:@include <stdio.h> |
213 |
|
@%:@include <stdlib.h>], |
214 |
|
[ |
215 |
|
FILE *f = fopen ("conftest.val", "w"); |
216 |
|
if (f) |
217 |
|
{ |
218 |
|
unsigned long i = conftestval (); |
219 |
|
if (0 <= ($2) && i == ($2)) |
220 |
|
{ |
221 |
|
fprintf (f, "%lu\n", i); |
222 |
|
if (! ferror (f) && fclose (f) == 0) |
223 |
|
exit (0); |
224 |
|
} |
225 |
|
} |
226 |
exit (1); |
exit (1); |
227 |
fprintf (f, "%d", ($2)); |
])]) |
|
fclose (f);])]) |
|
228 |
|
|
229 |
|
|
230 |
# ----------------- # |
# ----------------- # |