aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ChangeLog5
-rw-r--r--include/libiberty.h14
-rw-r--r--libiberty/ChangeLog18
-rw-r--r--libiberty/Makefile.in35
-rw-r--r--libiberty/aclocal.m452
-rw-r--r--libiberty/alloca.c74
-rw-r--r--libiberty/argv.c1
-rw-r--r--libiberty/config.in34
-rw-r--r--libiberty/config.table1
-rwxr-xr-xlibiberty/configure238
-rw-r--r--libiberty/configure.in27
11 files changed, 183 insertions, 316 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 8eb61e6..21ce684 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-06 Zack Weinberg <zackw@stanford.edu>
+
+ * libiberty.h: Prototype C_alloca; define alloca to either
+ __builtin_alloca or C_alloca as appropriate.
+
2001-03-01 John David Anglin <dave@hiauly1.hia.nrc.ca>
* safe-ctype.h (_sch_test): Cast enum bit to unsigned short int for pcc
diff --git a/include/libiberty.h b/include/libiberty.h
index 64d072b..e4fc2af 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -206,6 +206,20 @@ extern int vasprintf PARAMS ((char **, const char *, va_list))
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+/* Drastically simplified alloca configurator. If we're using GCC,
+ we use __builtin_alloca; otherwise we use the C alloca. The C
+ alloca is always available. You can override GCC by defining
+ USE_C_ALLOCA yourself. */
+extern PTR C_alloca PARAMS((size_t));
+#undef alloca
+#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
+# define alloca(x) __builtin_alloca(x)
+#else
+# define alloca(x) C_alloca(x)
+# undef USE_C_ALLOCA
+# define USE_C_ALLOCA 1
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index f898839..27cb034 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,21 @@
+2001-03-06 Zack Weinberg <zackw@stanford.edu>
+
+ * aclocal.m4 (libiberty_AC_FUNC_C_ALLOCA): New.
+ * configure.in: Replace all alloca logic with a simple use of
+ the above new macro.
+ * config.table: Kill *-*-beos* entry.
+ * config/mh-beos: Delete.
+ * configure, config.in: Regenerate.
+ * Makefile.in (ALLOCA, HFILES): Kill.
+ (REQUIRED_OFILES): Add alloca.o.
+ (alloca.o): Depend on libiberty.h.
+ (argv.o): Don't depend on alloca-conf.h.
+ * alloca-conf.h: Delete.
+ * alloca.c: Include libiberty.h. Kill all #ifdef emacs
+ blocks. Provide the C alloca unconditionally. Use PTR where
+ appropriate. Make i00afunc static.
+ * argv.c: Don't include alloca-conf.h.
+
2001-03-04 John David Anglin <dave@hiauly1.hia.nrc.ca>
* cplus-dem.c (main): Cast enum style to int.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 0eab5a6..5ea3bd5 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -64,7 +64,6 @@ MAKEOVERRIDES =
TARGETLIB = libiberty.a
LIBOBJS = @LIBOBJS@
-ALLOCA = @ALLOCA@
# A configuration can specify extra .o files that should be included,
# even if they are in libc. (Perhaps the libc version is buggy.)
@@ -118,9 +117,6 @@ install-info: install-info-subdir
clean-info: clean-info-subdir
dvi: dvi-subdir
-# Include files that are in this directory.
-HFILES = alloca-conf.h
-
# NOTE: If you add new files to the library, add them to this list
# (alphabetical), and add them to REQUIRED_OFILES or funcs in
# configure.in.
@@ -138,17 +134,17 @@ CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \
xmalloc.c xmemdup.c xstrdup.c xstrerror.c
# These are always included in the library.
-REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o cp-demangle.o \
- dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o \
- getruntime.o hashtab.o hex.o floatformat.o md5.o objalloc.o obstack.o \
- partition.o pexecute.o safe-ctype.o sort.o spaces.o splay-tree.o \
- strerror.o strsignal.o xatexit.o xexit.o xmalloc.o xmemdup.o \
- xstrdup.o xstrerror.o
-
-$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
+REQUIRED_OFILES = argv.o alloca.o choose-temp.o concat.o cplus-dem.o \
+ cp-demangle.o dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o \
+ getpwd.o getruntime.o hashtab.o hex.o floatformat.o md5.o objalloc.o \
+ obstack.o partition.o pexecute.o safe-ctype.o sort.o spaces.o \
+ splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \
+ xmemdup.o xstrdup.o xstrerror.o
+
+$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
-rm -f $(TARGETLIB)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
- $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(RANLIB) $(TARGETLIB)
INSTALL_DEST = @INSTALL_DEST@
@@ -197,8 +193,8 @@ stamp-picdir:
etags tags: TAGS etags-subdir
-TAGS: $(CFILES) $(HFILES)
- etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
+TAGS: $(CFILES)
+ etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
# The standalone demangler (c++filt) has been moved to binutils.
demangle:
@@ -207,7 +203,7 @@ demangle:
@false
ls:
- @echo Makefile $(HFILES) $(CFILES)
+ @echo Makefile $(CFILES)
# Need to deal with profiled libraries, too.
@@ -243,7 +239,6 @@ stamp-h: config.in config.status
config.status: $(srcdir)/configure $(srcdir)/config.table
$(SHELL) ./config.status --recheck
-
all-subdir check-subdir installcheck-subdir info-subdir \
install-info-subdir clean-info-subdir dvi-subdir install-subdir \
etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
@@ -254,11 +249,11 @@ maintainer-clean-subdir:
cd $$dir && $(MAKE) $$target; \
done
-$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir
+$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
-alloca.o: config.h
+alloca.o: config.h $(INCDIR)/libiberty.h
atexit.o: config.h
-argv.o: config.h alloca-conf.h $(INCDIR)/libiberty.h
+argv.o: config.h $(INCDIR)/libiberty.h
basename.o: $(INCDIR)/libiberty.h
choose-temp.o: config.h
clock.o: config.h
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index c562835..7b1b677 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -134,3 +134,55 @@ define(AC_DEFINE_NOAUTOHEADER,
[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
EOF
])
+
+# We always want a C version of alloca() compiled into libiberty,
+# because native-compiler support for the real alloca is so !@#$%
+# unreliable that GCC has decided to use it only when being compiled
+# by GCC. This is the part of AC_FUNC_ALLOCA that calculates the
+# information alloca.c needs.
+AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA,
+[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
+[AC_EGREP_CPP(webecray,
+[#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
+if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+ AC_CHECK_FUNC($ac_func,
+ [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
+ [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
+ systems. This function is required for alloca.c support on those
+ systems.]) break])
+ done
+fi
+
+AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
+[AC_TRY_RUN([find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}],
+ ac_cv_c_stack_direction=1,
+ ac_cv_c_stack_direction=-1,
+ ac_cv_c_stack_direction=0)])
+AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
+ [Define if you know the direction of stack growth for your system;
+ otherwise it will be automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown])
+])
diff --git a/libiberty/alloca.c b/libiberty/alloca.c
index 0f8a215..bf105d8 100644
--- a/libiberty/alloca.c
+++ b/libiberty/alloca.c
@@ -25,6 +25,8 @@
#include <config.h>
#endif
+#include <libiberty.h>
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -32,67 +34,20 @@
#include <stdlib.h>
#endif
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. Except of course if
- the C alloca is explicitly requested. */
-#if defined (USE_C_ALLOCA) || !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
+static long i00afunc ();
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
#ifndef NULL
#define NULL 0
#endif
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call use xmalloc.
-
- Callers below should use malloc. */
-
-#ifndef emacs
-#define malloc xmalloc
-#endif
-extern pointer malloc ();
-
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
@@ -168,9 +123,9 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
-pointer
-alloca (size)
- unsigned size;
+PTR
+C_alloca (size)
+ size_t size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
@@ -186,17 +141,13 @@ alloca (size)
{
register header *hp; /* Traverses linked list. */
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
- free ((pointer) hp); /* Collect garbage. */
+ free ((PTR) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
@@ -204,10 +155,6 @@ alloca (size)
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
}
if (size == 0)
@@ -216,7 +163,7 @@ alloca (size)
/* Allocate combined header + user data storage. */
{
- register pointer new = malloc (sizeof (header) + size);
+ register PTR new = xmalloc (sizeof (header) + size);
/* Address of header. */
if (new == 0)
@@ -229,7 +176,7 @@ alloca (size)
/* User storage begins just after header. */
- return (pointer) ((char *) new + sizeof (header));
+ return (PTR) ((char *) new + sizeof (header));
}
}
@@ -500,6 +447,3 @@ i00afunc (long address)
#endif /* not CRAY2 */
#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
diff --git a/libiberty/argv.c b/libiberty/argv.c
index 7aec9c0..3588285 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -48,7 +48,6 @@ extern char *strdup (); /* Duplicate a string */
#endif /* __STDC__ */
-#include "alloca-conf.h"
#ifndef NULL
#define NULL 0
diff --git a/libiberty/config.in b/libiberty/config.in
index 1fb946a..fa23f18 100644
--- a/libiberty/config.in
+++ b/libiberty/config.in
@@ -1,21 +1,8 @@
/* config.in. Generated automatically from configure.in by autoheader. */
-/* Define if using alloca.c. */
-#undef C_ALLOCA
-
/* Define to empty if the keyword does not work. */
#undef const
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-#undef CRAY_STACKSEG_END
-
-/* Define if you have alloca, as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#undef HAVE_ALLOCA_H
-
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
@@ -34,15 +21,6 @@
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
-
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
@@ -250,3 +228,15 @@
/* Define if you have the sys_siglist variable. */
#undef HAVE_SYS_SIGLIST
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
+ systems. This function is required for alloca.c support on those
+ systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you know the direction of stack growth for your system;
+ otherwise it will be automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
diff --git a/libiberty/config.table b/libiberty/config.table
index ea3312b..fa892c0 100644
--- a/libiberty/config.table
+++ b/libiberty/config.table
@@ -6,7 +6,6 @@ case "${host}" in
*-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
i370-*-opened*) frag=mh-openedition ;;
i[345]86-*-windows*) frag=mh-windows ;;
- *-*-beos*) frag=mh-beos ;;
esac
frags=$frag
diff --git a/libiberty/configure b/libiberty/configure
index ca24ef9..6b0aa20 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -1771,8 +1771,7 @@ fi
# For each of these functions, if the host does not provide the
# function we want to put FN.o in LIBOBJS, and if the host does
-# provide the function, we want to define HAVE_FN in config.h. Also,
-# if the host does not provide alloca, we set ALLOCA to alloca.o
+# provide the function, we want to define HAVE_FN in config.h.
setobjs=
CHECK=
@@ -1787,7 +1786,6 @@ if test -n "${with_target_subdir}"; then
# newlib provide and which ones we will be expected to provide.
if test "x${with_newlib}" = "xyes"; then
- ALLOCA="alloca.o"
LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
for f in $funcs; do
@@ -1917,7 +1915,7 @@ if test -z "${setobjs}"; then
# We haven't set the list of objects yet. Use the standard autoconf
# tests. This will only work if the compiler works.
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1921: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1919: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1928,12 +1926,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 1932 "configure"
+#line 1930 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1959,19 +1957,19 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1963: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1961: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
for ac_func in $funcs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1970: checking for $ac_func" >&5
+echo "configure:1968: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1975 "configure"
+#line 1973 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1994,7 +1992,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2020,131 +2018,13 @@ fi
done
-
- case "${host}" in
- *-*-interix)
- # On Interix, it wrongly concludes that the MSVC compiler supports alloca.
- # (MSVC does on Win32, not on Interix.)
- # This should be temporary.
-
- ac_cv_header_alloca_h=no
- ac_cv_func_alloca_works=no
- ALLOCA=alloca.o
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
- cat >> confdefs.h <<EOF
-#define STACK_DIRECTION -1
-EOF
- ;;
- *)
- # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments. Useless!
-echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:2045: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2050 "configure"
-#include "confdefs.h"
-#include <alloca.h>
-int main() {
-char *p = alloca(2 * sizeof(int));
-; return 0; }
-EOF
-if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_header_alloca_h=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_alloca_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
-EOF
-
-fi
-
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2078: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2083 "configure"
-#include "confdefs.h"
-
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_func_alloca_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-fi
-
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
-
-
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2143: checking whether alloca needs Cray hooks" >&5
+ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:2023: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2148 "configure"
+#line 2028 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -2167,14 +2047,14 @@ fi
echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2173: checking for $ac_func" >&5
+ for ac_func in _getb67 GETB67 getb67; do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2053: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2178 "configure"
+#line 2058 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2197,7 +2077,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2214,17 +2094,16 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
cat >> confdefs.h <<EOF
#define CRAY_STACKSEG_END $ac_func
EOF
-
break
else
echo "$ac_t""no" 1>&6
fi
-done
+ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2228: checking stack direction for C alloca" >&5
+echo "configure:2107: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2232,7 +2111,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 2236 "configure"
+#line 2115 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -2251,7 +2130,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:2255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -2270,18 +2149,14 @@ cat >> confdefs.h <<EOF
#define STACK_DIRECTION $ac_cv_c_stack_direction
EOF
-fi
-
- ;;
- esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2280: checking for ANSI C header files" >&5
+echo "configure:2155: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2285 "configure"
+#line 2160 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2289,7 +2164,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2306,7 +2181,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2310 "configure"
+#line 2185 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2324,7 +2199,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2328 "configure"
+#line 2203 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2345,7 +2220,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2349 "configure"
+#line 2224 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2356,7 +2231,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2380,12 +2255,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2384: checking for pid_t" >&5
+echo "configure:2259: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2389 "configure"
+#line 2264 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2414,17 +2289,17 @@ fi
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2418: checking for vfork.h" >&5
+echo "configure:2293: checking for vfork.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2423 "configure"
+#line 2298 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2449,18 +2324,18 @@ else
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2453: checking for working vfork" >&5
+echo "configure:2328: checking for working vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:2459: checking for vfork" >&5
+echo "configure:2334: checking for vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2464 "configure"
+#line 2339 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
@@ -2483,7 +2358,7 @@ vfork();
; return 0; }
EOF
-if { (eval echo configure:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vfork=yes"
else
@@ -2505,7 +2380,7 @@ fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
else
cat > conftest.$ac_ext <<EOF
-#line 2509 "configure"
+#line 2384 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
@@ -2600,7 +2475,7 @@ main() {
}
}
EOF
-if { (eval echo configure:2604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_vfork_works=yes
else
@@ -2627,19 +2502,19 @@ fi
fi
for v in $vars; do
echo $ac_n "checking for $v""... $ac_c" 1>&6
-echo "configure:2631: checking for $v" >&5
+echo "configure:2506: checking for $v" >&5
if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2636 "configure"
+#line 2511 "configure"
#include "confdefs.h"
int *p;
int main() {
extern int $v; p = &$v;
; return 0; }
EOF
-if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "libiberty_cv_var_$v=yes"
else
@@ -2665,12 +2540,12 @@ EOF
for ac_func in $checkfuncs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2669: checking for $ac_func" >&5
+echo "configure:2544: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2674 "configure"
+#line 2549 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2693,7 +2568,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2723,17 +2598,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2727: checking for $ac_hdr" >&5
+echo "configure:2602: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2732 "configure"
+#line 2607 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2762,12 +2637,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2766: checking for $ac_func" >&5
+echo "configure:2641: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2771 "configure"
+#line 2646 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2790,7 +2665,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2815,7 +2690,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2819: checking for working mmap" >&5
+echo "configure:2694: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2823,7 +2698,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 2827 "configure"
+#line 2702 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2963,7 +2838,7 @@ main()
}
EOF
-if { (eval echo configure:2967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -2987,7 +2862,7 @@ fi
echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:2991: checking for working strncmp" >&5
+echo "configure:2866: checking for working strncmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2995,7 +2870,7 @@ else
ac_cv_func_strncmp_works=no
else
cat > conftest.$ac_ext <<EOF
-#line 2999 "configure"
+#line 2874 "configure"
#include "confdefs.h"
/* Test by Jim Wilson and Kaveh Ghazi.
@@ -3056,7 +2931,7 @@ main ()
}
EOF
-if { (eval echo configure:3060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_strncmp_works=yes
else
@@ -3242,7 +3117,6 @@ s%@host_makefile_frag@%%g
s%@CPP@%$CPP%g
s%@CHECK@%$CHECK%g
s%@LIBOBJS@%$LIBOBJS%g
-s%@ALLOCA@%$ALLOCA%g
s%@INSTALL_DEST@%$INSTALL_DEST%g
CEOF
diff --git a/libiberty/configure.in b/libiberty/configure.in
index af80e0d..6adf48e 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -142,8 +142,7 @@ fi
# For each of these functions, if the host does not provide the
# function we want to put FN.o in LIBOBJS, and if the host does
-# provide the function, we want to define HAVE_FN in config.h. Also,
-# if the host does not provide alloca, we set ALLOCA to alloca.o
+# provide the function, we want to define HAVE_FN in config.h.
setobjs=
CHECK=
@@ -158,7 +157,6 @@ if test -n "${with_target_subdir}"; then
# newlib provide and which ones we will be expected to provide.
if test "x${with_newlib}" = "xyes"; then
- ALLOCA="alloca.o"
LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
for f in $funcs; do
@@ -277,28 +275,7 @@ if test -z "${setobjs}"; then
# tests. This will only work if the compiler works.
AC_PROG_CC_WORKS
AC_REPLACE_FUNCS($funcs)
-
- case "${host}" in
- *-*-interix)
- # On Interix, it wrongly concludes that the MSVC compiler supports alloca.
- # (MSVC does on Win32, not on Interix.)
- # This should be temporary.
-
- ac_cv_header_alloca_h=no
- ac_cv_func_alloca_works=no
- ALLOCA=alloca.o
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
- cat >> confdefs.h <<EOF
-#define STACK_DIRECTION -1
-EOF
- ;;
- *)
- AC_FUNC_ALLOCA
- ;;
- esac
-
+ libiberty_AC_FUNC_C_ALLOCA
AC_FUNC_VFORK
if test $ac_cv_func_vfork_works = no; then
LIBOBJS="$LIBOBJS vfork.o"