Artifact 3ac458530c78fc475457f36eb29d545400a12589:


0000: 64 6e 6c 20 43 6f 70 79 72 69 67 68 74 20 28 43  dnl Copyright (C
0010: 29 20 31 39 39 33 2d 32 30 30 33 20 46 72 65 65  ) 1993-2003 Free
0020: 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 61   Software Founda
0030: 74 69 6f 6e 2c 20 49 6e 63 2e 0a 64 6e 6c 20 54  tion, Inc..dnl T
0040: 68 69 73 20 66 69 6c 65 20 69 73 20 66 72 65 65  his file is free
0050: 20 73 6f 66 74 77 61 72 65 2c 20 64 69 73 74 72   software, distr
0060: 69 62 75 74 65 64 20 75 6e 64 65 72 20 74 68 65  ibuted under the
0070: 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 47 4e   terms of the GN
0080: 55 0a 64 6e 6c 20 47 65 6e 65 72 61 6c 20 50 75  U.dnl General Pu
0090: 62 6c 69 63 20 4c 69 63 65 6e 73 65 2e 20 20 41  blic License.  A
00a0: 73 20 61 20 73 70 65 63 69 61 6c 20 65 78 63 65  s a special exce
00b0: 70 74 69 6f 6e 20 74 6f 20 74 68 65 20 47 4e 55  ption to the GNU
00c0: 20 47 65 6e 65 72 61 6c 0a 64 6e 6c 20 50 75 62   General.dnl Pub
00d0: 6c 69 63 20 4c 69 63 65 6e 73 65 2c 20 74 68 69  lic License, thi
00e0: 73 20 66 69 6c 65 20 6d 61 79 20 62 65 20 64 69  s file may be di
00f0: 73 74 72 69 62 75 74 65 64 20 61 73 20 70 61 72  stributed as par
0100: 74 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 0a 64  t of a program.d
0110: 6e 6c 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73  nl that contains
0120: 20 61 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e   a configuration
0130: 20 73 63 72 69 70 74 20 67 65 6e 65 72 61 74 65   script generate
0140: 64 20 62 79 20 41 75 74 6f 63 6f 6e 66 2c 20 75  d by Autoconf, u
0150: 6e 64 65 72 0a 64 6e 6c 20 74 68 65 20 73 61 6d  nder.dnl the sam
0160: 65 20 64 69 73 74 72 69 62 75 74 69 6f 6e 20 74  e distribution t
0170: 65 72 6d 73 20 61 73 20 74 68 65 20 72 65 73 74  erms as the rest
0180: 20 6f 66 20 74 68 61 74 20 70 72 6f 67 72 61 6d   of that program
0190: 2e 0a 0a 64 6e 6c 20 46 72 6f 6d 20 42 72 75 6e  ...dnl From Brun
01a0: 6f 20 48 61 69 62 6c 65 2c 20 4d 61 72 63 75 73  o Haible, Marcus
01b0: 20 44 61 6e 69 65 6c 73 2e 0a 0a 41 43 5f 50 52   Daniels...AC_PR
01c0: 45 52 45 51 28 32 2e 31 33 29 0a 0a 41 43 5f 44  EREQ(2.13)..AC_D
01d0: 45 46 55 4e 28 5b 43 4c 5f 43 4f 44 45 45 58 45  EFUN([CL_CODEEXE
01e0: 43 5d 2c 0a 5b 41 43 5f 43 41 43 48 45 5f 43 48  C],.[AC_CACHE_CH
01f0: 45 43 4b 28 5b 77 68 65 74 68 65 72 20 63 6f 64  ECK([whether cod
0200: 65 20 69 6e 20 6d 61 6c 6c 6f 63 27 65 64 20 6d  e in malloc'ed m
0210: 65 6d 6f 72 79 20 69 73 20 65 78 65 63 75 74 61  emory is executa
0220: 62 6c 65 5d 2c 20 63 6c 5f 63 76 5f 63 6f 64 65  ble], cl_cv_code
0230: 65 78 65 63 2c 20 5b 0a 64 6e 6c 20 54 68 65 20  exec, [.dnl The 
0240: 74 65 73 74 20 62 65 6c 6f 77 20 64 6f 65 73 20  test below does 
0250: 6e 6f 74 20 77 6f 72 6b 20 6f 6e 20 68 6f 73 74  not work on host
0260: 3d 68 70 70 61 2a 2d 68 70 2d 68 70 75 78 2a 20  =hppa*-hp-hpux* 
0270: 62 65 63 61 75 73 65 20 6f 6e 20 74 68 69 73 20  because on this 
0280: 73 79 73 74 65 6d 0a 64 6e 6c 20 66 75 6e 63 74  system.dnl funct
0290: 69 6f 6e 20 70 6f 69 6e 74 65 72 73 20 61 72 65  ion pointers are
02a0: 20 61 63 74 75 61 6c 6c 79 20 70 6f 69 6e 74 65   actually pointe
02b0: 72 73 20 69 6e 74 6f 28 21 29 20 61 20 74 77 6f  rs into(!) a two
02c0: 2d 70 6f 69 6e 74 65 72 20 73 74 72 75 63 74 2e  -pointer struct.
02d0: 0a 64 6e 6c 20 54 68 65 20 74 65 73 74 20 62 65  .dnl The test be
02e0: 6c 6f 77 20 64 6f 65 73 20 6e 6f 74 20 77 6f 72  low does not wor
02f0: 6b 20 6f 6e 20 68 6f 73 74 3d 72 73 36 30 30 30  k on host=rs6000
0300: 2d 2a 2d 2a 20 62 65 63 61 75 73 65 20 6f 6e 20  -*-* because on 
0310: 74 68 69 73 20 73 79 73 74 65 6d 0a 64 6e 6c 20  this system.dnl 
0320: 66 75 6e 63 74 69 6f 6e 20 70 6f 69 6e 74 65 72  function pointer
0330: 73 20 61 72 65 20 61 63 74 75 61 6c 6c 79 20 70  s are actually p
0340: 6f 69 6e 74 65 72 73 20 74 6f 20 61 20 74 68 72  ointers to a thr
0350: 65 65 2d 70 6f 69 6e 74 65 72 20 73 74 72 75 63  ee-pointer struc
0360: 74 2e 0a 63 61 73 65 20 22 24 68 6f 73 74 5f 6f  t..case "$host_o
0370: 73 22 20 69 6e 0a 20 20 68 70 75 78 2a 29 20 63  s" in.  hpux*) c
0380: 6c 5f 63 76 5f 63 6f 64 65 65 78 65 63 3d 22 67  l_cv_codeexec="g
0390: 75 65 73 73 69 6e 67 20 79 65 73 22 20 3b 3b 0a  uessing yes" ;;.
03a0: 20 20 2a 29 0a 63 61 73 65 20 22 24 68 6f 73 74    *).case "$host
03b0: 5f 63 70 75 22 20 69 6e 0a 20 20 23 20 4f 6e 20  _cpu" in.  # On 
03c0: 68 6f 73 74 3d 72 73 36 30 30 30 2d 2a 2d 61 69  host=rs6000-*-ai
03d0: 78 33 2e 32 2e 35 20 6d 61 6c 6c 6f 63 27 65 64  x3.2.5 malloc'ed
03e0: 20 6d 65 6d 6f 72 79 20 69 73 20 69 6e 64 65 65   memory is indee
03f0: 64 20 6e 6f 74 20 65 78 65 63 75 74 61 62 6c 65  d not executable
0400: 2e 0a 20 20 72 73 36 30 30 30 29 20 63 6c 5f 63  ..  rs6000) cl_c
0410: 76 5f 63 6f 64 65 65 78 65 63 3d 22 67 75 65 73  v_codeexec="gues
0420: 73 69 6e 67 20 6e 6f 22 20 3b 3b 0a 20 20 2a 29  sing no" ;;.  *)
0430: 0a 41 43 5f 54 52 59 5f 52 55 4e 28 5b 0a 23 69  .AC_TRY_RUN([.#i
0440: 6e 63 6c 75 64 65 20 3c 73 79 73 2f 74 79 70 65  nclude <sys/type
0450: 73 2e 68 3e 0a 2f 2a 20 64 65 63 6c 61 72 65 20  s.h>./* declare 
0460: 6d 61 6c 6c 6f 63 28 29 20 2a 2f 0a 23 69 6e 63  malloc() */.#inc
0470: 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 0a  lude <stdlib.h>.
0480: 69 6e 74 20 66 75 6e 20 28 29 20 7b 20 72 65 74  int fun () { ret
0490: 75 72 6e 20 33 31 34 31 35 39 32 36 3b 20 7d 0a  urn 31415926; }.
04a0: 69 6e 74 20 6d 61 69 6e 20 28 29 0a 7b 20 6c 6f  int main ().{ lo
04b0: 6e 67 20 73 69 7a 65 20 3d 20 28 63 68 61 72 2a  ng size = (char*
04c0: 29 26 6d 61 69 6e 20 2d 20 28 63 68 61 72 2a 29  )&main - (char*)
04d0: 26 66 75 6e 3b 0a 20 20 63 68 61 72 2a 20 66 75  &fun;.  char* fu
04e0: 6e 63 6f 70 79 20 3d 20 28 63 68 61 72 2a 29 20  ncopy = (char*) 
04f0: 6d 61 6c 6c 6f 63 28 73 69 7a 65 29 3b 0a 20 20  malloc(size);.  
0500: 69 6e 74 20 69 3b 0a 20 20 66 6f 72 20 28 69 20  int i;.  for (i 
0510: 3d 20 30 3b 20 69 20 3c 20 73 69 7a 65 3b 20 69  = 0; i < size; i
0520: 2b 2b 29 20 7b 20 66 75 6e 63 6f 70 79 5b 69 5d  ++) { funcopy[i]
0530: 20 3d 20 28 28 63 68 61 72 2a 29 26 66 75 6e 29   = ((char*)&fun)
0540: 5b 69 5d 3b 20 7d 0a 20 20 65 78 69 74 28 21 28  [i]; }.  exit(!(
0550: 28 2a 28 69 6e 74 28 2a 29 28 29 29 66 75 6e 63  (*(int(*)())func
0560: 6f 70 79 29 28 29 20 3d 3d 20 33 31 34 31 35 39  opy)() == 314159
0570: 32 36 29 29 3b 0a 7d 5d 2c 20 63 6c 5f 63 76 5f  26));.}], cl_cv_
0580: 63 6f 64 65 65 78 65 63 3d 79 65 73 2c 20 72 6d  codeexec=yes, rm
0590: 20 2d 66 20 63 6f 72 65 0a 63 6c 5f 63 76 5f 63   -f core.cl_cv_c
05a0: 6f 64 65 65 78 65 63 3d 6e 6f 2c 20 63 6c 5f 63  odeexec=no, cl_c
05b0: 76 5f 63 6f 64 65 65 78 65 63 3d 22 67 75 65 73  v_codeexec="gues
05c0: 73 69 6e 67 20 79 65 73 22 29 0a 20 20 3b 3b 0a  sing yes").  ;;.
05d0: 65 73 61 63 0a 20 20 3b 3b 0a 65 73 61 63 0a 5d  esac.  ;;.esac.]
05e0: 29 0a 63 61 73 65 20 22 24 63 6c 5f 63 76 5f 63  ).case "$cl_cv_c
05f0: 6f 64 65 65 78 65 63 22 20 69 6e 0a 20 20 2a 79  odeexec" in.  *y
0600: 65 73 29 20 41 43 5f 44 45 46 49 4e 45 28 43 4f  es) AC_DEFINE(CO
0610: 44 45 5f 45 58 45 43 55 54 41 42 4c 45 29 20 3b  DE_EXECUTABLE) ;
0620: 3b 0a 20 20 2a 6e 6f 29 20 20 3b 3b 0a 65 73 61  ;.  *no)  ;;.esa
0630: 63 0a 5d 29 0a                                   c.]).