diff options
Diffstat (limited to 'ocaml-binary-annot/config/auto-aux')
31 files changed, 987 insertions, 0 deletions
diff --git a/ocaml-binary-annot/config/auto-aux/.cvsignore b/ocaml-binary-annot/config/auto-aux/.cvsignore new file mode 100644 index 0000000000..cb1ca8a9f0 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/.cvsignore @@ -0,0 +1 @@ +camlp4_config.ml diff --git a/ocaml-binary-annot/config/auto-aux/align.c b/ocaml-binary-annot/config/auto-aux/align.c new file mode 100644 index 0000000000..0bedf77a02 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/align.c @@ -0,0 +1,103 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> +#include <signal.h> +#include <setjmp.h> + +long foo; + +void access16(short int *p) +{ + foo = *p; +} + +void access32(long int *p) +{ + foo = *p; +} + +jmp_buf failure; + +void sig_handler(int dummy) +{ + longjmp(failure, 1); +} + +int test(void (*fct) (/* ??? */), char *p) +{ + int res; + + signal(SIGSEGV, sig_handler); + signal(SIGBUS, sig_handler); + if(setjmp(failure) == 0) { + fct(p); + res = 0; + } else { + res = 1; + } + signal(SIGSEGV, SIG_DFL); + signal(SIGBUS, SIG_DFL); + return res; +} + +jmp_buf timer; + +void alarm_handler(int dummy) +{ + longjmp(timer, 1); +} + +void use(int n) +{ + return; +} + +int speedtest(char *p) +{ + int * q; + volatile int total; + int i; + volatile int sum; + + signal(SIGALRM, alarm_handler); + sum = 0; + if (setjmp(timer) == 0) { + alarm(1); + total = 0; + while(1) { + for (q = (int *) p, i = 1000; i > 0; q++, i--) + sum += *q; + total++; + } + } + use(sum); + signal(SIGALRM, SIG_DFL); + return total; +} + +main(void) +{ + long n[1001]; + int speed_aligned, speed_unaligned; + + if (test(access16, (char *) n + 1)) exit(1); + if (test(access32, (char *) n + 1)) exit(1); + if (test(access32, (char *) n + 2)) exit(1); + speed_aligned = speedtest((char *) n); + speed_unaligned = speedtest((char *) n + 1); + if (speed_aligned >= 3 * speed_unaligned) exit(1); + exit(0); +} diff --git a/ocaml-binary-annot/config/auto-aux/ansi.c b/ocaml-binary-annot/config/auto-aux/ansi.c new file mode 100644 index 0000000000..f1a416b857 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/ansi.c @@ -0,0 +1,21 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1997 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +int main() +{ +#ifdef __STDC__ + return 0; +#else + return 1; +#endif +} diff --git a/ocaml-binary-annot/config/auto-aux/async_io.c b/ocaml-binary-annot/config/auto-aux/async_io.c new file mode 100644 index 0000000000..2b5faa2d70 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/async_io.c @@ -0,0 +1,60 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> +#include <fcntl.h> +#include <signal.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/socket.h> +#include "s.h" + +int signalled; + +void sigio_handler(int arg) +{ + signalled = 1; +} + +int main(void) +{ +#if defined(SIGIO) && defined(FASYNC) && defined(F_SETFL) && defined(F_SETOWN) + int p[2]; + int ret; +#define OUT 0 +#define IN 1 + if (socketpair(PF_UNIX, SOCK_STREAM, 0, p) == -1) return 1; + signalled = 0; + signal(SIGIO, sigio_handler); + ret = fcntl(p[OUT], F_GETFL, 0); + fcntl(p[OUT], F_SETFL, ret | FASYNC); + fcntl(p[OUT], F_SETOWN, getpid()); + switch(fork()) { + case -1: + return 1; + case 0: + close(p[OUT]); + write(p[IN], "x", 1); + sleep(1); + exit(0); + default: + close(p[IN]); + while(wait(NULL) == -1 && errno == EINTR) /*nothing*/; + } + if (signalled) return 0; else return 1; +#else + return 1; +#endif +} diff --git a/ocaml-binary-annot/config/auto-aux/bytecopy.c b/ocaml-binary-annot/config/auto-aux/bytecopy.c new file mode 100644 index 0000000000..923b444e5b --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/bytecopy.c @@ -0,0 +1,34 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +char buffer[27]; + +#ifdef reverse +#define cpy(s1,s2,n) copy(s2,s1,n) +#else +#define cpy copy +#endif + +int main(int argc, char ** argv) +{ + cpy("abcdefghijklmnopqrstuvwxyz", buffer, 27); + if (strcmp(buffer, "abcdefghijklmnopqrstuvwxyz") != 0) exit(1); + cpy(buffer, buffer+3, 26-3); + if (strcmp(buffer, "abcabcdefghijklmnopqrstuvw") != 0) exit(1); + cpy("abcdefghijklmnopqrstuvwxyz", buffer, 27); + cpy(buffer+3, buffer, 26-3); + if (strcmp(buffer, "defghijklmnopqrstuvwxyzxyz") != 0) exit(1); + exit(0); +} diff --git a/ocaml-binary-annot/config/auto-aux/dblalign.c b/ocaml-binary-annot/config/auto-aux/dblalign.c new file mode 100644 index 0000000000..c2520381ce --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/dblalign.c @@ -0,0 +1,54 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> +#include <signal.h> +#include <setjmp.h> + +double foo; + +void access_double(double *p) +{ + foo = *p; +} + +jmp_buf failure; + +void sig_handler(int sig) +{ + longjmp(failure, 1); +} + +int main(void) +{ + long n[10]; + int res; + signal(SIGSEGV, sig_handler); +#ifdef SIGBUS + signal(SIGBUS, sig_handler); +#endif + if(setjmp(failure) == 0) { + access_double((double *) n); + access_double((double *) (n+1)); + res = 0; + } else { + res = 1; + } + signal(SIGSEGV, SIG_DFL); +#ifdef SIGBUS + signal(SIGBUS, SIG_DFL); +#endif + exit(res); +} diff --git a/ocaml-binary-annot/config/auto-aux/divmod.c b/ocaml-binary-annot/config/auto-aux/divmod.c new file mode 100644 index 0000000000..8f69dabf35 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/divmod.c @@ -0,0 +1,47 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +/* Test semantics of division and modulus for negative arguments */ + +long div4[] = +{ -4,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,-1,-1,0,0,0, + 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4 }; + +long divm4[] = +{ 4,3,3,3,3,2,2,2,2,1,1,1,1,0,0,0, + 0,0,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-3,-3,-3,-3,-4 }; + +long mod4[] = +{ 0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1, + 0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0 }; + +long modm4[] = +{ 0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1, + 0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0 }; + +long q1 = 4; +long q2 = -4; + +int main() +{ + int i; + for (i = -16; i <= 16; i++) { + if (i / q1 != div4[i+16]) return 1; + if (i / q2 != divm4[i+16]) return 1; + if (i % q1 != mod4[i+16]) return 1; + if (i % q2 != modm4[i+16]) return 1; + } + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/elf.c b/ocaml-binary-annot/config/auto-aux/elf.c new file mode 100644 index 0000000000..026c4838eb --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/elf.c @@ -0,0 +1,26 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1999 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> + +int main(int argc, char ** argv) +{ +#ifdef __ELF__ + printf("elf\n"); +#else + printf("aout\n"); +#endif + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/endian.c b/ocaml-binary-annot/config/auto-aux/endian.c new file mode 100644 index 0000000000..def617f0f5 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/endian.c @@ -0,0 +1,41 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include "m.h" + +#ifndef ARCH_SIXTYFOUR +long intval = 0x41424344L; +char * bigendian = "ABCD"; +char * littleendian = "DCBA"; +#else +long intval = 0x4142434445464748L; +char * bigendian = "ABCDEFGH"; +char * littleendian = "HGFEDCBA"; +#endif + +main(void) +{ + long n[2]; + char * p; + + n[0] = intval; + n[1] = 0; + p = (char *) n; + if (strcmp(p, bigendian) == 0) + exit(0); + if (strcmp(p, littleendian) == 0) + exit(1); + exit(2); +} diff --git a/ocaml-binary-annot/config/auto-aux/getgroups.c b/ocaml-binary-annot/config/auto-aux/getgroups.c new file mode 100644 index 0000000000..1ed8a1fbb1 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/getgroups.c @@ -0,0 +1,32 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <sys/types.h> +#include <limits.h> + +#ifdef NGROUPS_MAX + +int main(void) +{ + int gidset[NGROUPS_MAX]; + if (getgroups(NGROUPS_MAX, gidset) == -1) return 1; + return 0; +} + +#else + +int main(void) { return 1; } + +#endif diff --git a/ocaml-binary-annot/config/auto-aux/gethostbyaddr.c b/ocaml-binary-annot/config/auto-aux/gethostbyaddr.c new file mode 100644 index 0000000000..c5dd129719 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/gethostbyaddr.c @@ -0,0 +1,51 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 2002 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#ifndef _REENTRANT +/* This helps detection on Digital Unix... */ +#define _REENTRANT +#endif + +#include <sys/types.h> +#include <netdb.h> + +int main(int argc, char ** argv) +{ +#if NUM_ARGS == 7 + char * address; + int length; + int type; + struct hostent h; + char buffer[10]; + int buflen; + int h_errnop; + struct hostent * hp; + hp = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &h_errnop); +#elif NUM_ARGS == 8 + char * address; + int length; + int type; + struct hostent h; + char buffer[10]; + int buflen; + int h_errnop; + struct hostent * hp; + int rc; + rc = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &hp, &h_errnop); +#endif + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/gethostbyname.c b/ocaml-binary-annot/config/auto-aux/gethostbyname.c new file mode 100644 index 0000000000..043b9d3343 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/gethostbyname.c @@ -0,0 +1,41 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 2002 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#ifndef _REENTRANT +/* This helps detection on Digital Unix... */ +#define _REENTRANT +#endif + +#include <sys/types.h> +#include <netdb.h> + +int main(int argc, char ** argv) +{ +#if NUM_ARGS == 5 + struct hostent *hp; + struct hostent h; + char buffer[1000]; + int h_errno; + hp = gethostbyname_r("www.caml.org", &h, buffer, 10, &h_errno); +#elif NUM_ARGS == 6 + struct hostent *hp; + struct hostent h; + char buffer[1000]; + int h_errno; + int rc; + rc = gethostbyname_r("www.caml.org", &h, buffer, 10, &hp, &h_errno); +#endif + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/hasgot b/ocaml-binary-annot/config/auto-aux/hasgot new file mode 100755 index 0000000000..5014b903d7 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/hasgot @@ -0,0 +1,29 @@ +#!/bin/sh + +opts="" +libs="$cclibs" +args=$* +rm -f hasgot.c +var="x" +while : ; do + case "$1" in + -i) echo "#include <$2>" >> hasgot.c; shift;; + -t) echo "$2 $var;" >> hasgot.c; var="x$var"; shift;; + -l*|-L*|-F*) libs="$libs $1";; + -framework) libs="$libs $1 $2"; shift;; + -*) opts="$opts $1";; + *) break;; + esac + shift +done + +(echo "main() {" + for f in $*; do echo " $f();"; done + echo "}") >> hasgot.c + +if test "$verbose" = yes; then + echo "hasgot $args: $cc $opts -o tst hasgot.c $libs" >&2 + exec $cc $opts -o tst hasgot.c $libs > /dev/null +else + exec $cc $opts -o tst hasgot.c $libs > /dev/null 2>/dev/null +fi diff --git a/ocaml-binary-annot/config/auto-aux/ia32sse2.c b/ocaml-binary-annot/config/auto-aux/ia32sse2.c new file mode 100644 index 0000000000..cbe114626a --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/ia32sse2.c @@ -0,0 +1,24 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 2003 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +/* Test whether IA32 assembler supports SSE2 instructions */ + +int main() +{ + asm("pmuludq %mm1, %mm0"); + asm("paddq %mm1, %mm0"); + asm("psubq %mm1, %mm0"); + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/initgroups.c b/ocaml-binary-annot/config/auto-aux/initgroups.c new file mode 100644 index 0000000000..b6e0ffbdf2 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/initgroups.c @@ -0,0 +1,26 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Copyright 2009 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* Contributed by Stephane Glondu <steph@glondu.net> */ + +/* $Id$ */ + +#include <errno.h> + +#include <sys/types.h> +#include <limits.h> +#include <grp.h> + +int main(void) +{ + if (initgroups("root", 0) == -1 && errno != EPERM) return 1; + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/int64align.c b/ocaml-binary-annot/config/auto-aux/int64align.c new file mode 100644 index 0000000000..6bdd25567a --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/int64align.c @@ -0,0 +1,55 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 2000 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> +#include <signal.h> +#include <setjmp.h> +#include "m.h" + +ARCH_INT64_TYPE foo; + +void access_int64(ARCH_INT64_TYPE *p) +{ + foo = *p; +} + +jmp_buf failure; + +void sig_handler(int sig) +{ + longjmp(failure, 1); +} + +int main(void) +{ + long n[10]; + int res; + signal(SIGSEGV, sig_handler); +#ifdef SIGBUS + signal(SIGBUS, sig_handler); +#endif + if(setjmp(failure) == 0) { + access_int64((ARCH_INT64_TYPE *) n); + access_int64((ARCH_INT64_TYPE *) (n+1)); + res = 0; + } else { + res = 1; + } + signal(SIGSEGV, SIG_DFL); +#ifdef SIGBUS + signal(SIGBUS, SIG_DFL); +#endif + exit(res); +} diff --git a/ocaml-binary-annot/config/auto-aux/longlong.c b/ocaml-binary-annot/config/auto-aux/longlong.c new file mode 100644 index 0000000000..bcdf4c974b --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/longlong.c @@ -0,0 +1,43 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> +#include <string.h> + +/* Check for the availability of "long long" type as per ISO C9X */ + +/* Meaning of return code: + 0 long long OK, printf with %ll + 1 long long OK, printf with %q + 2 long long OK, no printf + 3 long long not suitable */ + +int main(int argc, char **argv) +{ + long long l; + unsigned long long u; + char buffer[64]; + + if (sizeof(long long) != 8) return 3; + l = 123456789123456789LL; + buffer[0] = '\0'; + sprintf(buffer, "%lld", l); + if (strcmp(buffer, "123456789123456789") == 0) return 0; + /* the MacOS X library uses qd to format long longs */ + buffer[0] = '\0'; + sprintf (buffer, "%qd", l); + if (strcmp (buffer, "123456789123456789") == 0) return 1; + return 2; +} diff --git a/ocaml-binary-annot/config/auto-aux/runtest b/ocaml-binary-annot/config/auto-aux/runtest new file mode 100755 index 0000000000..ce65bd07f1 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/runtest @@ -0,0 +1,8 @@ +#!/bin/sh +if test "$verbose" = yes; then +echo "runtest: $cc -o tst $* $cclibs" >&2 +$cc -o tst $* $cclibs || exit 100 +else +$cc -o tst $* $cclibs 2> /dev/null || exit 100 +fi +exec ./tst diff --git a/ocaml-binary-annot/config/auto-aux/schar.c b/ocaml-binary-annot/config/auto-aux/schar.c new file mode 100644 index 0000000000..55d49f31a7 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/schar.c @@ -0,0 +1,23 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +char foo[]="\377"; + +int main(int argc, char ** argv) +{ + int i; + i = foo[0]; + exit(i != -1); +} diff --git a/ocaml-binary-annot/config/auto-aux/schar2.c b/ocaml-binary-annot/config/auto-aux/schar2.c new file mode 100644 index 0000000000..d1d781a53e --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/schar2.c @@ -0,0 +1,23 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +signed char foo[]="\377"; + +int main(int argc, char ** argv) +{ + int i; + i = foo[0]; + exit(i != -1); +} diff --git a/ocaml-binary-annot/config/auto-aux/searchpath b/ocaml-binary-annot/config/auto-aux/searchpath new file mode 100755 index 0000000000..9b31267f67 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/searchpath @@ -0,0 +1,9 @@ +#!/bin/sh +# Find a program in the path + +IFS=':' +for dir in $PATH; do + if test -z "$dir"; then dir=.; fi + if test -f $dir/$1; then exit 0; fi +done +exit 1 diff --git a/ocaml-binary-annot/config/auto-aux/setgroups.c b/ocaml-binary-annot/config/auto-aux/setgroups.c new file mode 100644 index 0000000000..5cfe49c082 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/setgroups.c @@ -0,0 +1,28 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Copyright 2009 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* Contributed by Stephane Glondu <steph@glondu.net> */ + +/* $Id$ */ + +#include <errno.h> + +#include <sys/types.h> +#include <limits.h> +#include <grp.h> + +int main(void) +{ + gid_t gidset[1]; + gidset[0] = 0; + if (setgroups(1, gidset) == -1 && errno != EPERM) return 1; + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/sharpbang b/ocaml-binary-annot/config/auto-aux/sharpbang new file mode 100755 index 0000000000..eb447baa6e --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/sharpbang @@ -0,0 +1,2 @@ +#! /bin/cat +exit 1 diff --git a/ocaml-binary-annot/config/auto-aux/sharpbang2 b/ocaml-binary-annot/config/auto-aux/sharpbang2 new file mode 100755 index 0000000000..3753096347 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/sharpbang2 @@ -0,0 +1,2 @@ +#! /usr/bin/cat +exit 1 diff --git a/ocaml-binary-annot/config/auto-aux/sighandler.c b/ocaml-binary-annot/config/auto-aux/sighandler.c new file mode 100644 index 0000000000..7e748df572 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/sighandler.c @@ -0,0 +1,23 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <signal.h> + +int main(void) +{ + SIGRETURN (*old)(); + old = signal(SIGQUIT, SIG_DFL); + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/signals.c b/ocaml-binary-annot/config/auto-aux/signals.c new file mode 100644 index 0000000000..df0a8b0b50 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/signals.c @@ -0,0 +1,68 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +/* To determine the semantics of signal handlers + (System V: signal is reset to default behavior on entrance to the handler + BSD: signal handler remains active). */ + +#include <stdio.h> +#include <signal.h> + +/* Find a signal that is ignored by default */ + +#ifdef SIGCHLD +#define IGNSIG SIGCHLD +#else +#ifdef SIGIO +#define IGNSIG SIGIO +#else +#ifdef SIGCLD +#define IGNSIG SIGCLD +#else +#ifdef SIGPWR +#define IGNSIG SIGPWR +#endif +#endif +#endif +#endif + +#ifdef IGNSIG + +int counter; + +void sig_handler(int dummy) +{ + counter++; +} + +int main(int argc, char **argv) +{ + signal(IGNSIG, sig_handler); + counter = 0; + kill(getpid(), IGNSIG); + kill(getpid(), IGNSIG); + return (counter == 2 ? 0 : 1); +} + +#else + +/* If no suitable signal was found, assume System V */ + +int main(int argc, char ** argv) +{ + return 1; +} + +#endif diff --git a/ocaml-binary-annot/config/auto-aux/sizes.c b/ocaml-binary-annot/config/auto-aux/sizes.c new file mode 100644 index 0000000000..992c47a658 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/sizes.c @@ -0,0 +1,23 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> + +int main(int argc, char **argv) +{ + printf("%d %d %d %d\n", + sizeof(int), sizeof(long), sizeof(long *), sizeof(short)); + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/solaris-ld b/ocaml-binary-annot/config/auto-aux/solaris-ld new file mode 100644 index 0000000000..3ab90bceff --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/solaris-ld @@ -0,0 +1,7 @@ +#!/bin/sh +# Determine if gcc calls the Solaris ld or the GNU ld +# Exit code is 0 for Solaris ld, 1 for GNU ld + +echo "int main() { return 0; }" > hasgot.c +$cc -v -o tst hasgot.c 2>&1 | grep -s '^ld:' > /dev/null +exit $? diff --git a/ocaml-binary-annot/config/auto-aux/stackov.c b/ocaml-binary-annot/config/auto-aux/stackov.c new file mode 100644 index 0000000000..39e4e832be --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/stackov.c @@ -0,0 +1,68 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 2001 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include <stdio.h> +#include <signal.h> +#include <sys/resource.h> + +static char sig_alt_stack[SIGSTKSZ]; +static char * system_stack_top; + +#if defined(TARGET_i386) && defined(SYS_linux_elf) +static void segv_handler(int signo, struct sigcontext sc) +{ + char * fault_addr = (char *) sc.cr2; +#else +static void segv_handler(int signo, siginfo_t * info, void * context) +{ + char * fault_addr = (char *) info->si_addr; +#endif + struct rlimit limit; + + if (getrlimit(RLIMIT_STACK, &limit) == 0 && + ((long) fault_addr & (sizeof(long) - 1)) == 0 && + fault_addr < system_stack_top && + fault_addr >= system_stack_top - limit.rlim_cur - 0x2000) { + _exit(0); + } else { + _exit(4); + } +} + +int main(int argc, char ** argv) +{ + stack_t stk; + struct sigaction act; + + stk.ss_sp = sig_alt_stack; + stk.ss_size = SIGSTKSZ; + stk.ss_flags = 0; +#if defined(TARGET_i386) && defined(SYS_linux_elf) + act.sa_handler = (void (*)(int)) segv_handler; + act.sa_flags = SA_ONSTACK | SA_NODEFER; +#else + act.sa_sigaction = segv_handler; + act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_NODEFER; +#endif + sigemptyset(&act.sa_mask); + system_stack_top = (char *) &act; + if (sigaltstack(&stk, NULL) != 0) { perror("sigaltstack"); return 2; } + if (sigaction(SIGSEGV, &act, NULL) != 0) { perror("sigaction"); return 2; } + /* We used to trigger a stack overflow at this point to test whether + the code above works, but this causes problems with POSIX threads + on some BSD systems. So, instead, we just test that all this + code compiles, indicating that the required syscalls are there. */ + return 0; +} diff --git a/ocaml-binary-annot/config/auto-aux/tclversion.c b/ocaml-binary-annot/config/auto-aux/tclversion.c new file mode 100644 index 0000000000..77c0bb729e --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/tclversion.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <tcl.h> +#include <tk.h> + +main () +{ + puts(TCL_VERSION); +} diff --git a/ocaml-binary-annot/config/auto-aux/trycompile b/ocaml-binary-annot/config/auto-aux/trycompile new file mode 100755 index 0000000000..797a1c3869 --- /dev/null +++ b/ocaml-binary-annot/config/auto-aux/trycompile @@ -0,0 +1,7 @@ +#!/bin/sh +if test "$verbose" = yes; then +echo "trycompile: $cc -o tst $* $cclibs" >&2 +$cc -o tst $* $cclibs || exit 100 +else +$cc -o tst $* $cclibs 2> /dev/null || exit 100 +fi |
