/[gnats]/gnats/libiberty/aclocal.m4
ViewVC logotype

Diff of /gnats/libiberty/aclocal.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pdm, Mon Dec 10 23:03:27 2001 UTC revision 1.2 by chewie, Sat Nov 13 05:14:17 2004 UTC
# Line 1  Line 1 
1    sinclude(../config/accross.m4)
2    sinclude(../config/acx.m4)
3    sinclude(../config/no-executables.m4)
4    
5  dnl See whether strncmp reads past the end of its string parameters.  dnl See whether strncmp reads past the end of its string parameters.
6  dnl On some versions of SunOS4 at least, strncmp reads a word at a time  dnl On some versions of SunOS4 at least, strncmp reads a word at a time
7  dnl but erroneously reads past the end of strings.  This can cause  dnl but erroneously reads past the end of strings.  This can cause
# Line 48  main () Line 52  main ()
52    p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,    p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
53                       MAP_ANON|MAP_PRIVATE, dev_zero, 0);                       MAP_ANON|MAP_PRIVATE, dev_zero, 0);
54    if (p == (char *)-1)    if (p == (char *)-1)
55        p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
56                           MAP_ANON|MAP_PRIVATE, -1, 0);
57      if (p == (char *)-1)
58      exit (2);      exit (2);
59    else    else
60      {      {
# Line 66  main () Line 73  main ()
73    ac_cv_func_strncmp_works=no)    ac_cv_func_strncmp_works=no)
74  rm -f core core.* *.core])  rm -f core core.* *.core])
75  if test $ac_cv_func_strncmp_works = no ; then  if test $ac_cv_func_strncmp_works = no ; then
76    LIBOBJS="$LIBOBJS strncmp.o"    AC_LIBOBJ([strncmp])
77  fi  fi
78  ])  ])
79    
# Line 84  then AC_DEFINE(NEED_DECLARATION_ERRNO, 1 Line 91  then AC_DEFINE(NEED_DECLARATION_ERRNO, 1
91  fi  fi
92  ])  ])
93    
94  # FIXME: We temporarily define our own version of AC_PROG_CC.  This is  dnl See whether we need a declaration for a function.
95  # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We  AC_DEFUN(libiberty_NEED_DECLARATION,
96  # are probably using a cross compiler, which will not be able to fully  [AC_MSG_CHECKING([whether $1 must be declared])
97  # link an executable.  This should really be fixed in autoconf  AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
98  # itself.  [AC_TRY_COMPILE([
99    #include "confdefs.h"
100  AC_DEFUN(LIB_AC_PROG_CC,  #include <stdio.h>
101  [AC_BEFORE([$0], [AC_PROG_CPP])dnl  #ifdef HAVE_STRING_H
102  AC_PROVIDE([AC_PROG_CC])  #include <string.h>
103  AC_CHECK_PROG(CC, gcc, gcc)  #else
104  if test -z "$CC"; then  #ifdef HAVE_STRINGS_H
105    AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)  #include <strings.h>
106    test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])  #endif
107  fi  #endif
108    #ifdef HAVE_STDLIB_H
109  AC_PROG_CC_GNU  #include <stdlib.h>
110    #endif
111  if test $ac_cv_prog_gcc = yes; then  #ifdef HAVE_UNISTD_H
112    GCC=yes  #include <unistd.h>
113    ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'  #endif],
114  dnl Check whether -g works, even if CFLAGS is set, in case the package  [char *(*pfn) = (char *(*)) $1],
115  dnl plays around with CFLAGS (such as to build both debugging and  libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
116  dnl normal versions of a library), tasteless as that idea is.  AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
117    ac_test_CFLAGS="${CFLAGS+set}"  if test $libiberty_cv_decl_needed_$1 = yes; then
118    ac_save_CFLAGS="$CFLAGS"    AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
119    CFLAGS=              [Define if $1 is not declared in system header files.])
   AC_PROG_CC_G  
   if test "$ac_test_CFLAGS" = set; then  
     CFLAGS="$ac_save_CFLAGS"  
   elif test $ac_cv_prog_cc_g = yes; then  
     CFLAGS="-g -O2"  
   else  
     CFLAGS="-O2"  
   fi  
 else  
   GCC=  
   ac_libiberty_warn_cflags=  
   test "${CFLAGS+set}" = set || CFLAGS="-g"  
120  fi  fi
121  AC_SUBST(ac_libiberty_warn_cflags)  ])dnl
 ])  
122    
123  # Work around a bug in autoheader.  This can go away when we switch to  # Work around a bug in autoheader.  This can go away when we switch to
124  # autoconf >2.50.  The use of define instead of AC_DEFUN is  # autoconf >2.50.  The use of define instead of AC_DEFUN is
# Line 134  define(AC_DEFINE_NOAUTOHEADER, Line 128  define(AC_DEFINE_NOAUTOHEADER,
128  [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)  [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
129  EOF  EOF
130  ])  ])
131    
132    # We always want a C version of alloca() compiled into libiberty,
133    # because native-compiler support for the real alloca is so !@#$%
134    # unreliable that GCC has decided to use it only when being compiled
135    # by GCC.  This is the part of AC_FUNC_ALLOCA that calculates the
136    # information alloca.c needs.
137    AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA,
138    [AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
139    [AC_EGREP_CPP(webecray,
140    [#if defined(CRAY) && ! defined(CRAY2)
141    webecray
142    #else
143    wenotbecray
144    #endif
145    ], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
146    if test $ac_cv_os_cray = yes; then
147      for ac_func in _getb67 GETB67 getb67; do
148        AC_CHECK_FUNC($ac_func,
149          [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
150      [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
151       systems. This function is required for alloca.c support on those
152       systems.])  break])
153      done
154    fi
155    
156    AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
157    [AC_TRY_RUN([find_stack_direction ()
158    {
159      static char *addr = 0;
160      auto char dummy;
161      if (addr == 0)
162        {
163          addr = &dummy;
164          return find_stack_direction ();
165        }
166      else
167        return (&dummy > addr) ? 1 : -1;
168    }
169    main ()
170    {
171      exit (find_stack_direction() < 0);
172    }],
173      ac_cv_c_stack_direction=1,
174      ac_cv_c_stack_direction=-1,
175      ac_cv_c_stack_direction=0)])
176    AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
177      [Define if you know the direction of stack growth for your system;
178       otherwise it will be automatically deduced at run-time.
179            STACK_DIRECTION > 0 => grows toward higher addresses
180            STACK_DIRECTION < 0 => grows toward lower addresses
181            STACK_DIRECTION = 0 => direction of growth unknown])
182    ])
183    
184    # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
185    # ----------------------------------
186    # Don't include <ctype.h> because on OSF/1 3.0 it includes
187    # <sys/types.h> which includes <sys/select.h> which contains a
188    # prototype for select.  Similarly for bzero.
189    #
190    # This test used to merely assign f=$1 in main(), but that was
191    # optimized away by HP unbundled cc A.05.36 for ia64 under +O3,
192    # presumably on the basis that there's no need to do that store if the
193    # program is about to exit.  Conversely, the AIX linker optimizes an
194    # unused external declaration that initializes f=$1.  So this test
195    # program has both an external initialization of f, and a use of f in
196    # main that affects the exit status.
197    #
198    m4_define([AC_LANG_FUNC_LINK_TRY(C)],
199    [AC_LANG_PROGRAM(
200    [/* System header to define __stub macros and hopefully few prototypes,
201        which can conflict with char $1 (); below.
202        Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
203        <limits.h> exists even on freestanding compilers.  Under hpux,
204        including <limits.h> includes <sys/time.h> and causes problems
205        checking for functions defined therein.  */
206    #if defined (__STDC__) && !defined (_HPUX_SOURCE)
207    # include <limits.h>
208    #else
209    # include <assert.h>
210    #endif
211    /* Override any gcc2 internal prototype to avoid an error.  */
212    #ifdef __cplusplus
213    extern "C"
214    {
215    #endif
216    /* We use char because int might match the return type of a gcc2
217       builtin and then its argument prototype would still apply.  */
218    char $1 ();
219    /* The GNU C library defines this for functions which it implements
220        to always fail with ENOSYS.  Some functions are actually named
221        something starting with __ and the normal name is an alias.  */
222    #if defined (__stub_$1) || defined (__stub___$1)
223    choke me
224    #else
225    char (*f) () = $1;
226    #endif
227    #ifdef __cplusplus
228    }
229    #endif
230    ], [return f != $1;])])
231    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26