$NetBSD: patch-ad,v 1.1 2003/09/23 18:40:06 tron Exp $

--- libiberty/configure.in.orig	2003-03-03 01:48:39.000000000 +0100
+++ libiberty/configure.in	2003-09-22 14:11:57.000000000 +0200
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script
 
-AC_PREREQ(2.13)
+AC_PREREQ(2.57)
 AC_INIT(pexecute.c)
 
 dnl We use these options to decide which functions to include.
@@ -36,51 +36,14 @@
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 
-# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable.  This should really be fixed in autoconf
-# itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_PROVIDE([AC_PROG_CC])
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
-  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
-  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
+AC_PROG_CC
 
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
+if test x$GCC = xyes; then
   ac_libiberty_warn_cflags='-W -Wall -Wtraditional'
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
-  ac_test_CFLAGS="${CFLAGS+set}"
-  ac_save_CFLAGS="$CFLAGS"
-  CFLAGS=
-  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"
 fi
-])
 AC_SUBST(ac_libiberty_warn_cflags)
 
-LIB_AC_PROG_CC
-
-AC_ISC_POSIX
+AC_PROG_CC_C_O
 
 dnl When we start using libtool:
 dnl Default to a non shared library.  This may be overridden by the
@@ -195,7 +158,12 @@
 
   if test "x${with_newlib}" = "xyes"; then
     ALLOCA="alloca.o"
-    LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
+    AC_LIBOBJ([asprintf])
+    AC_LIBOBJ([basename])
+    AC_LIBOBJ([insque])
+    AC_LIBOBJ([random])
+    AC_LIBOBJ([strdup])
+    AC_LIBOBJ([vasprintf])
 
     for f in $funcs; do
       case "$f" in
@@ -234,8 +202,16 @@
     # Handle VxWorks configuration specially, since on VxWorks the
     # libraries are actually on the target board, not in the file
     # system.
-    LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
-    LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
+    AC_LIBOBJ([basename])
+    AC_LIBOBJ([getpagesize])
+    AC_LIBOBJ([insque])
+    AC_LIBOBJ([random])
+    AC_LIBOBJ([strcasecmp])
+    AC_LIBOBJ([strncasecmp])
+    AC_LIBOBJ([strdup])
+    AC_LIBOBJ([vfork])
+    AC_LIBOBJ([waitpid])
+    AC_LIBOBJ([vasprintf])
     for f in $funcs; do
       case "$f" in
 	basename | getpagesize | insque | random | strcasecmp)
@@ -278,7 +254,7 @@
     # missing.
 
     funcs="`echo $funcs | sed -e 's/random//'`"
-    LIBOBJS="$LIBOBJS random.o"
+    AC_LIBOBJ([random])
     vars="`echo $vars | sed -e 's/sys_siglist//'`"
     checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
     ;;
@@ -307,7 +283,7 @@
 
   # We haven't set the list of objects yet.  Use the standard autoconf
   # tests.  This will only work if the compiler works.
-  AC_PROG_CC_WORKS
+  AC_ISC_POSIX
   AC_REPLACE_FUNCS($funcs)
 
   case "${host}" in
@@ -333,7 +309,7 @@
 
   AC_FUNC_VFORK
   if test $ac_cv_func_vfork_works = no; then
-    LIBOBJS="$LIBOBJS vfork.o"
+    AC_LIBOBJ([vfork])
   fi
   for v in $vars; do
     AC_MSG_CHECKING([for $v])
