X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tools-for-build%2Fwhere-is-mcontext.c;fp=tools-for-build%2Fwhere-is-mcontext.c;h=7754111e997a32c08983810b886c09af70c7ee51;hb=c65f4c06c83c9dbf213cece638ad3d59710841bb;hp=0000000000000000000000000000000000000000;hpb=80d37651bc4cba800bbf2ba38ea720d734fbae4a;p=sbcl.git diff --git a/tools-for-build/where-is-mcontext.c b/tools-for-build/where-is-mcontext.c new file mode 100644 index 0000000..7754111 --- /dev/null +++ b/tools-for-build/where-is-mcontext.c @@ -0,0 +1,54 @@ +/* + * Find the offset of uc_mcontext in a ucontext structure, to enable + * building on both (glibc-2.3.1 and earlier) and (glibc-2.3.2 and + * later), after the glibc developers broke source code compatibility. + * (see also Debian bugs #207806 and #209074) + */ + +/* + * This software is part of the SBCL system. See the README file for + * more information. + * + * While most of SBCL is derived from the CMU CL system, many + * utilities for the build process (like this one) were written from + * scratch after the fork from CMU CL. + * + * This software is in the public domain and is provided with + * absolutely no warranty. See the COPYING and CREDITS files for + * more information. + */ + +#include +#include +#include + +int main (int argc, char *argv[]) { + + if(argc != 1) { + fprintf(stderr,"%s: command line arguments provided. Don't do that.\n", argv[0]); + exit(1); + } + + printf("\ +/* This is an automatically-generated file; please do not edit it.\n\ + See the program tools-for-build/where-is-mcontext.c.\n\ + */\n\n"); + + printf("\ +#ifndef PPC_LINUX_MCONTEXT_H\n\ +#define PPC_LINUX_MCONTEXT_H\n\n"); + + switch (offsetof(ucontext_t,uc_mcontext)) { + case 192: + printf("#define GLIBC232_STYLE_UCONTEXT\n\n"); + break; + case 20: + printf("#define GLIBC231_STYLE_UCONTEXT\n\n"); + break; + default: + printf("#error \"Unknown PPC/Linux ucontext layout\"\n\n"); + } + printf("\ +#endif /* PPC_LINUX_MCONTEXT_H */\n"); +} +