Artifact
ea5fa03211e9da752801081d0d9fe3c552348c1b:
0000: 64 6e 6c 20 2d 2a 2d 20 41 75 74 6f 63 6f 6e 66 dnl -*- Autoconf
0010: 20 2d 2a 2d 0a 64 6e 6c 20 43 6f 70 79 72 69 67 -*-.dnl Copyrig
0020: 68 74 20 28 43 29 20 31 39 39 33 2d 32 30 31 30 ht (C) 1993-2010
0030: 20 46 72 65 65 20 53 6f 66 74 77 61 72 65 20 46 Free Software F
0040: 6f 75 6e 64 61 74 69 6f 6e 2c 20 49 6e 63 2e 0a oundation, Inc..
0050: 64 6e 6c 20 54 68 69 73 20 66 69 6c 65 20 69 73 dnl This file is
0060: 20 66 72 65 65 20 73 6f 66 74 77 61 72 65 2c 20 free software,
0070: 64 69 73 74 72 69 62 75 74 65 64 20 75 6e 64 65 distributed unde
0080: 72 20 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 r the terms of t
0090: 68 65 20 47 4e 55 0a 64 6e 6c 20 47 65 6e 65 72 he GNU.dnl Gener
00a0: 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 al Public Licens
00b0: 65 2e 20 20 41 73 20 61 20 73 70 65 63 69 61 6c e. As a special
00c0: 20 65 78 63 65 70 74 69 6f 6e 20 74 6f 20 74 68 exception to th
00d0: 65 20 47 4e 55 20 47 65 6e 65 72 61 6c 0a 64 6e e GNU General.dn
00e0: 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 l Public License
00f0: 2c 20 74 68 69 73 20 66 69 6c 65 20 6d 61 79 20 , this file may
0100: 62 65 20 64 69 73 74 72 69 62 75 74 65 64 20 61 be distributed a
0110: 73 20 70 61 72 74 20 6f 66 20 61 20 70 72 6f 67 s part of a prog
0120: 72 61 6d 0a 64 6e 6c 20 74 68 61 74 20 63 6f 6e ram.dnl that con
0130: 74 61 69 6e 73 20 61 20 63 6f 6e 66 69 67 75 72 tains a configur
0140: 61 74 69 6f 6e 20 73 63 72 69 70 74 20 67 65 6e ation script gen
0150: 65 72 61 74 65 64 20 62 79 20 41 75 74 6f 63 6f erated by Autoco
0160: 6e 66 2c 20 75 6e 64 65 72 0a 64 6e 6c 20 74 68 nf, under.dnl th
0170: 65 20 73 61 6d 65 20 64 69 73 74 72 69 62 75 74 e same distribut
0180: 69 6f 6e 20 74 65 72 6d 73 20 61 73 20 74 68 65 ion terms as the
0190: 20 72 65 73 74 20 6f 66 20 74 68 61 74 20 70 72 rest of that pr
01a0: 6f 67 72 61 6d 2e 0a 0a 64 6e 6c 20 46 72 6f 6d ogram...dnl From
01b0: 20 42 72 75 6e 6f 20 48 61 69 62 6c 65 2c 20 4d Bruno Haible, M
01c0: 61 72 63 75 73 20 44 61 6e 69 65 6c 73 2c 20 53 arcus Daniels, S
01d0: 61 6d 20 53 74 65 69 6e 67 6f 6c 64 2e 0a 0a 41 am Steingold...A
01e0: 43 5f 50 52 45 52 45 51 28 32 2e 31 33 29 0a 0a C_PREREQ(2.13)..
01f0: 41 43 5f 44 45 46 55 4e 28 5b 43 45 5f 44 4f 43 AC_DEFUN([CE_DOC
0200: 5d 2c 5b 77 68 65 74 68 65 72 20 63 6f 64 65 20 ],[whether code
0210: 69 6e 20 6d 61 6c 6c 6f 63 28 29 65 64 20 6d 65 in malloc()ed me
0220: 6d 6f 72 79 20 69 73 20 65 78 65 63 75 74 61 62 mory is executab
0230: 6c 65 5d 29 0a 41 43 5f 44 45 46 55 4e 28 5b 46 le]).AC_DEFUN([F
0240: 46 43 41 4c 4c 5f 43 4f 44 45 45 58 45 43 5d 2c FCALL_CODEEXEC],
0250: 5b 41 43 5f 43 41 43 48 45 5f 43 48 45 43 4b 28 [AC_CACHE_CHECK(
0260: 43 45 5f 44 4f 43 2c 20 66 66 63 61 6c 6c 5f 63 CE_DOC, ffcall_c
0270: 76 5f 63 6f 64 65 65 78 65 63 2c 20 5b 64 6e 6c v_codeexec, [dnl
0280: 0a 64 6e 6c 20 54 68 65 20 74 65 73 74 20 62 65 .dnl The test be
0290: 6c 6f 77 20 64 6f 65 73 20 6e 6f 74 20 77 6f 72 low does not wor
02a0: 6b 20 6f 6e 20 68 6f 73 74 3d 68 70 70 61 2a 2d k on host=hppa*-
02b0: 68 70 2d 68 70 75 78 2a 20 62 65 63 61 75 73 65 hp-hpux* because
02c0: 20 6f 6e 20 74 68 69 73 20 73 79 73 74 65 6d 0a on this system.
02d0: 64 6e 6c 20 66 75 6e 63 74 69 6f 6e 20 70 6f 69 dnl function poi
02e0: 6e 74 65 72 73 20 61 72 65 20 61 63 74 75 61 6c nters are actual
02f0: 6c 79 20 70 6f 69 6e 74 65 72 73 20 69 6e 74 6f ly pointers into
0300: 28 21 29 20 61 20 74 77 6f 2d 70 6f 69 6e 74 65 (!) a two-pointe
0310: 72 20 73 74 72 75 63 74 2e 0a 64 6e 6c 20 54 68 r struct..dnl Th
0320: 65 20 74 65 73 74 20 62 65 6c 6f 77 20 64 6f 65 e test below doe
0330: 73 20 6e 6f 74 20 77 6f 72 6b 20 6f 6e 20 68 6f s not work on ho
0340: 73 74 3d 72 73 36 30 30 30 2d 2a 2d 2a 20 62 65 st=rs6000-*-* be
0350: 63 61 75 73 65 20 6f 6e 20 74 68 69 73 20 73 79 cause on this sy
0360: 73 74 65 6d 0a 64 6e 6c 20 66 75 6e 63 74 69 6f stem.dnl functio
0370: 6e 20 70 6f 69 6e 74 65 72 73 20 61 72 65 20 61 n pointers are a
0380: 63 74 75 61 6c 6c 79 20 70 6f 69 6e 74 65 72 73 ctually pointers
0390: 20 74 6f 20 61 20 74 68 72 65 65 2d 70 6f 69 6e to a three-poin
03a0: 74 65 72 20 73 74 72 75 63 74 2e 0a 63 61 73 65 ter struct..case
03b0: 20 22 24 68 6f 73 74 5f 6f 73 22 20 69 6e 0a 20 "$host_os" in.
03c0: 20 68 70 75 78 2a 29 20 66 66 63 61 6c 6c 5f 63 hpux*) ffcall_c
03d0: 76 5f 63 6f 64 65 65 78 65 63 3d 22 67 75 65 73 v_codeexec="gues
03e0: 73 69 6e 67 20 79 65 73 22 20 3b 3b 0a 20 20 2a sing yes" ;;. *
03f0: 29 0a 63 61 73 65 20 22 24 48 4f 53 54 5f 43 50 ).case "$HOST_CP
0400: 55 5f 43 5f 41 42 49 22 2d 22 24 68 6f 73 74 5f U_C_ABI"-"$host_
0410: 6f 73 22 20 69 6e 0a 20 20 23 20 4f 6e 20 68 6f os" in. # On ho
0420: 73 74 3d 72 73 36 30 30 30 2d 2a 2d 61 69 78 33 st=rs6000-*-aix3
0430: 2e 32 2e 35 20 6d 61 6c 6c 6f 63 27 65 64 20 6d .2.5 malloc'ed m
0440: 65 6d 6f 72 79 20 69 73 20 69 6e 64 65 65 64 20 emory is indeed
0450: 6e 6f 74 20 65 78 65 63 75 74 61 62 6c 65 2e 0a not executable..
0460: 20 20 70 6f 77 65 72 70 63 2d 61 69 78 2a 29 20 powerpc-aix*)
0470: 66 66 63 61 6c 6c 5f 63 76 5f 63 6f 64 65 65 78 ffcall_cv_codeex
0480: 65 63 3d 22 67 75 65 73 73 69 6e 67 20 6e 6f 22 ec="guessing no"
0490: 20 3b 3b 0a 20 20 2a 29 0a 41 43 5f 54 52 59 5f ;;. *).AC_TRY_
04a0: 52 55 4e 28 47 4c 5f 4e 4f 43 52 41 53 48 5b 0a RUN(GL_NOCRASH[.
04b0: 23 69 6e 63 6c 75 64 65 20 3c 73 79 73 2f 74 79 #include <sys/ty
04c0: 70 65 73 2e 68 3e 0a 2f 2a 20 64 65 63 6c 61 72 pes.h>./* declar
04d0: 65 20 6d 61 6c 6c 6f 63 28 29 20 2a 2f 0a 23 69 e malloc() */.#i
04e0: 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 nclude <stdlib.h
04f0: 3e 0a 69 6e 74 20 66 75 6e 20 28 29 20 7b 20 72 >.int fun () { r
0500: 65 74 75 72 6e 20 33 31 34 31 35 39 32 36 3b 20 eturn 31415926;
0510: 7d 0a 69 6e 74 20 6d 61 69 6e 20 28 29 0a 7b 20 }.int main ().{
0520: 6e 6f 63 72 61 73 68 5f 69 6e 69 74 28 29 3b 0a nocrash_init();.
0530: 20 7b 6c 6f 6e 67 20 73 69 7a 65 20 3d 20 28 63 {long size = (c
0540: 68 61 72 2a 29 26 6d 61 69 6e 20 2d 20 28 63 68 har*)&main - (ch
0550: 61 72 2a 29 26 66 75 6e 3b 0a 20 20 63 68 61 72 ar*)&fun;. char
0560: 2a 20 66 75 6e 63 6f 70 79 20 3d 20 28 63 68 61 * funcopy = (cha
0570: 72 2a 29 20 6d 61 6c 6c 6f 63 28 73 69 7a 65 29 r*) malloc(size)
0580: 3b 0a 20 20 69 6e 74 20 69 3b 0a 20 20 66 6f 72 ;. int i;. for
0590: 20 28 69 20 3d 20 30 3b 20 69 20 3c 20 73 69 7a (i = 0; i < siz
05a0: 65 3b 20 69 2b 2b 29 20 7b 20 66 75 6e 63 6f 70 e; i++) { funcop
05b0: 79 5b 69 5d 20 3d 20 28 28 63 68 61 72 2a 29 26 y[i] = ((char*)&
05c0: 66 75 6e 29 5b 69 5d 3b 20 7d 0a 20 20 72 65 74 fun)[i]; }. ret
05d0: 75 72 6e 20 21 28 28 2a 28 69 6e 74 28 2a 29 28 urn !((*(int(*)(
05e0: 29 29 66 75 6e 63 6f 70 79 29 28 29 20 3d 3d 20 ))funcopy)() ==
05f0: 33 31 34 31 35 39 32 36 29 3b 0a 7d 7d 5d 2c 20 31415926);.}}],
0600: 66 66 63 61 6c 6c 5f 63 76 5f 63 6f 64 65 65 78 ffcall_cv_codeex
0610: 65 63 3d 79 65 73 2c 20 66 66 63 61 6c 6c 5f 63 ec=yes, ffcall_c
0620: 76 5f 63 6f 64 65 65 78 65 63 3d 6e 6f 2c 0a 66 v_codeexec=no,.f
0630: 66 63 61 6c 6c 5f 63 76 5f 63 6f 64 65 65 78 65 fcall_cv_codeexe
0640: 63 3d 22 67 75 65 73 73 69 6e 67 20 79 65 73 22 c="guessing yes"
0650: 29 0a 20 20 3b 3b 0a 65 73 61 63 0a 20 20 3b 3b ). ;;.esac. ;;
0660: 0a 65 73 61 63 0a 5d 29 0a 63 61 73 65 20 22 24 .esac.]).case "$
0670: 66 66 63 61 6c 6c 5f 63 76 5f 63 6f 64 65 65 78 ffcall_cv_codeex
0680: 65 63 22 20 69 6e 0a 20 20 2a 79 65 73 29 20 41 ec" in. *yes) A
0690: 43 5f 44 45 46 49 4e 45 28 5b 43 4f 44 45 5f 45 C_DEFINE([CODE_E
06a0: 58 45 43 55 54 41 42 4c 45 5d 2c 20 5b 5d 2c 20 XECUTABLE], [],
06b0: 43 45 5f 44 4f 43 29 20 3b 3b 0a 20 20 2a 6e 6f CE_DOC) ;;. *no
06c0: 29 20 20 3b 3b 0a 65 73 61 63 0a 5d 29 0a ) ;;.esac.]).