Fix make-array transforms.
[sbcl.git] / tools-for-build / where-is-mcontext.c
1 /*
2  * Find the offset of uc_mcontext in a ucontext structure, to enable
3  * building on both (glibc-2.3.1 and earlier) and (glibc-2.3.2 and
4  * later), after the glibc developers broke source code compatibility.
5  * (see also Debian bugs #207806 and #209074)
6  */
7
8 /*
9  * This software is part of the SBCL system. See the README file for
10  * more information.
11  *
12  * While most of SBCL is derived from the CMU CL system, many
13  * utilities for the build process (like this one) were written from
14  * scratch after the fork from CMU CL.
15  *
16  * This software is in the public domain and is provided with
17  * absolutely no warranty. See the COPYING and CREDITS files for
18  * more information.
19  */
20
21 #include <stdio.h>
22 #include <stddef.h>
23 #include <stdlib.h>
24 #include <sys/ucontext.h>
25
26 int main (int argc, char *argv[]) {
27
28     if(argc != 1) {
29         fprintf(stderr,"%s: command line arguments provided.  Don't do that.\n", argv[0]);
30         exit(1);
31     }
32
33     printf("\
34 /* This is an automatically-generated file; please do not edit it.\n\
35    See the program tools-for-build/where-is-mcontext.c.\n\
36  */\n\n");
37
38     printf("\
39 #ifndef PPC_LINUX_MCONTEXT_H\n\
40 #define PPC_LINUX_MCONTEXT_H\n\n");
41
42     if (offsetof(ucontext_t,uc_mcontext) > 40) {
43         printf("#define GLIBC232_STYLE_UCONTEXT\n\n");
44     } else {
45         printf("#define GLIBC231_STYLE_UCONTEXT\n\n");
46     }
47     printf("\
48 #endif /* PPC_LINUX_MCONTEXT_H */\n");
49     exit(0);
50 }
51