OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libiberty/] [aclocal.m4] - Blame information for rev 758

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 736 jeremybenn
sinclude(../config/acx.m4)
2
sinclude(../config/no-executables.m4)
3
sinclude(../config/override.m4)
4
sinclude(../config/picflag.m4)
5
sinclude(../config/warnings.m4)
6
 
7
dnl See whether strncmp reads past the end of its string parameters.
8
dnl On some versions of SunOS4 at least, strncmp reads a word at a time
9
dnl but erroneously reads past the end of strings.  This can cause
10
dnl a SEGV in some cases.
11
AC_DEFUN(libiberty_AC_FUNC_STRNCMP,
12
[AC_REQUIRE([AC_FUNC_MMAP])
13
AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
14
[AC_TRY_RUN([
15
/* Test by Jim Wilson and Kaveh Ghazi.
16
   Check whether strncmp reads past the end of its string parameters. */
17
#include <sys/types.h>
18
 
19
#ifdef HAVE_FCNTL_H
20
#include <fcntl.h>
21
#endif
22
 
23
#ifdef HAVE_SYS_MMAN_H
24
#include <sys/mman.h>
25
#endif
26
 
27
#ifndef MAP_ANON
28
#ifdef MAP_ANONYMOUS
29
#define MAP_ANON MAP_ANONYMOUS
30
#else
31
#define MAP_ANON MAP_FILE
32
#endif
33
#endif
34
 
35
#ifndef MAP_FILE
36
#define MAP_FILE 0
37
#endif
38
#ifndef O_RDONLY
39
#define O_RDONLY 0
40
#endif
41
 
42
#define MAP_LEN 0x10000
43
 
44
main ()
45
{
46
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
47
  char *p;
48
  int dev_zero;
49
 
50
  dev_zero = open ("/dev/zero", O_RDONLY);
51
  if (dev_zero < 0)
52
    exit (1);
53
 
54
  p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
55
                     MAP_ANON|MAP_PRIVATE, dev_zero, 0);
56
  if (p == (char *)-1)
57
    p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
58
                       MAP_ANON|MAP_PRIVATE, -1, 0);
59
  if (p == (char *)-1)
60
    exit (2);
61
  else
62
    {
63
      char *string = "__si_type_info";
64
      char *q = (char *) p + MAP_LEN - strlen (string) - 2;
65
      char *r = (char *) p + 0xe;
66
 
67
      strcpy (q, string);
68
      strcpy (r, string);
69
      strncmp (r, q, 14);
70
    }
71
#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
72
  exit (0);
73
}
74
], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no,
75
  ac_cv_func_strncmp_works=yes)
76
rm -f core core.* *.core])
77
if test $ac_cv_func_strncmp_works = no ; then
78
  AC_LIBOBJ([strncmp])
79
fi
80
])
81
 
82
dnl See if errno must be declared even when <errno.h> is included.
83
AC_DEFUN(libiberty_AC_DECLARE_ERRNO,
84
[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno,
85
[AC_TRY_COMPILE(
86
[#include <errno.h>],
87
[int x = errno;],
88
libiberty_cv_declare_errno=no,
89
libiberty_cv_declare_errno=yes)])
90
if test $libiberty_cv_declare_errno = yes
91
then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
92
  [Define if errno must be declared even when <errno.h> is included.])
93
fi
94
])
95
 
96
dnl See whether we need a declaration for a function.
97
AC_DEFUN(libiberty_NEED_DECLARATION,
98
[AC_MSG_CHECKING([whether $1 must be declared])
99
AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
100
[AC_TRY_COMPILE([
101
#include "confdefs.h"
102
#include <stdio.h>
103
#ifdef HAVE_STRING_H
104
#include <string.h>
105
#else
106
#ifdef HAVE_STRINGS_H
107
#include <strings.h>
108
#endif
109
#endif
110
#ifdef HAVE_STDLIB_H
111
#include <stdlib.h>
112
#endif
113
#ifdef HAVE_UNISTD_H
114
#include <unistd.h>
115
#endif],
116
[char *(*pfn) = (char *(*)) $1],
117
libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
118
AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
119
if test $libiberty_cv_decl_needed_$1 = yes; then
120
  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
121
            [Define if $1 is not declared in system header files.])
122
fi
123
])dnl
124
 
125
# We always want a C version of alloca() compiled into libiberty,
126
# because native-compiler support for the real alloca is so !@#$%
127
# unreliable that GCC has decided to use it only when being compiled
128
# by GCC.  This is the part of AC_FUNC_ALLOCA that calculates the
129
# information alloca.c needs.
130
AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA,
131
[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
132
[AC_EGREP_CPP(webecray,
133
[#if defined(CRAY) && ! defined(CRAY2)
134
webecray
135
#else
136
wenotbecray
137
#endif
138
], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
139
if test $ac_cv_os_cray = yes; then
140
  for ac_func in _getb67 GETB67 getb67; do
141
    AC_CHECK_FUNC($ac_func,
142
      [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
143
  [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
144
   systems. This function is required for alloca.c support on those
145
   systems.])  break])
146
  done
147
fi
148
 
149
AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
150
[AC_TRY_RUN([find_stack_direction ()
151
{
152
  static char *addr = 0;
153
  auto char dummy;
154
  if (addr == 0)
155
    {
156
      addr = &dummy;
157
      return find_stack_direction ();
158
    }
159
  else
160
    return (&dummy > addr) ? 1 : -1;
161
}
162
main ()
163
{
164
  exit (find_stack_direction() < 0);
165
}],
166
  ac_cv_c_stack_direction=1,
167
  ac_cv_c_stack_direction=-1,
168
  ac_cv_c_stack_direction=0)])
169
AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
170
  [Define if you know the direction of stack growth for your system;
171
   otherwise it will be automatically deduced at run-time.
172
        STACK_DIRECTION > 0 => grows toward higher addresses
173
        STACK_DIRECTION < 0 => grows toward lower addresses
174
        STACK_DIRECTION = 0 => direction of growth unknown])
175
])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.