Make util.c replacement functions use autoconf conditionals to probe

what is Really available in the host OS.
This commit is contained in:
tv 2002-01-25 17:51:31 +00:00
parent fa4a18f612
commit 3dc61f3b98
3 changed files with 87 additions and 25 deletions

83
tools/make/configure vendored
View File

@ -2024,6 +2024,75 @@ if test "$ac_cv_search_regfree" != no; then
fi fi
for ac_func in setenv strdup strerror strftime vsnprintf
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:2030: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line 2036 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
char (*f) ();
int
main ()
{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
f = $ac_func;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:2067: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:2070: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:2073: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:2076: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:2086: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<EOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
EOF
fi
done
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure # tests run on this system so they can be shared between configure
@ -2133,7 +2202,7 @@ rm -f confdef2opt.sed
: ${CONFIG_STATUS=./config.status} : ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS" ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:2136: creating $CONFIG_STATUS" >&5 { echo "$as_me:2205: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;} echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL #! $SHELL
@ -2300,7 +2369,7 @@ cat >>$CONFIG_STATUS <<\EOF
echo "$ac_cs_version"; exit 0 ;; echo "$ac_cs_version"; exit 0 ;;
--he | --h) --he | --h)
# Conflict between --help and --header # Conflict between --help and --header
{ { echo "$as_me:2303: error: ambiguous option: $1 { { echo "$as_me:2372: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5 Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1 echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;} Try \`$0 --help' for more information." >&2;}
@ -2319,7 +2388,7 @@ Try \`$0 --help' for more information." >&2;}
ac_need_defaults=false;; ac_need_defaults=false;;
# This is an error. # This is an error.
-*) { { echo "$as_me:2322: error: unrecognized option: $1 -*) { { echo "$as_me:2391: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5 Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1 echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;} Try \`$0 --help' for more information." >&2;}
@ -2355,7 +2424,7 @@ do
case "$ac_config_target" in case "$ac_config_target" in
# Handling of arguments. # Handling of arguments.
"buildmake.sh" ) CONFIG_FILES="$CONFIG_FILES buildmake.sh" ;; "buildmake.sh" ) CONFIG_FILES="$CONFIG_FILES buildmake.sh" ;;
*) { { echo "$as_me:2358: error: invalid argument: $ac_config_target" >&5 *) { { echo "$as_me:2427: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;} echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };; { (exit 1); exit 1; }; };;
esac esac
@ -2552,7 +2621,7 @@ done; }
esac esac
if test x"$ac_file" != x-; then if test x"$ac_file" != x-; then
{ echo "$as_me:2555: creating $ac_file" >&5 { echo "$as_me:2624: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;} echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file" rm -f "$ac_file"
fi fi
@ -2570,7 +2639,7 @@ echo "$as_me: creating $ac_file" >&6;}
-) echo $tmp/stdin ;; -) echo $tmp/stdin ;;
[\\/$]*) [\\/$]*)
# Absolute (can't be DOS-style, as IFS=:) # Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:2573: error: cannot find input file: $f" >&5 test -f "$f" || { { echo "$as_me:2642: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;} echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; } { (exit 1); exit 1; }; }
echo $f;; echo $f;;
@ -2583,7 +2652,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
echo $srcdir/$f echo $srcdir/$f
else else
# /dev/null tree # /dev/null tree
{ { echo "$as_me:2586: error: cannot find input file: $f" >&5 { { echo "$as_me:2655: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;} echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; } { (exit 1); exit 1; }; }
fi;; fi;;

View File

@ -1,4 +1,4 @@
# $NetBSD: configure.ac,v 1.1 2002/01/15 19:15:47 tv Exp $ # $NetBSD: configure.ac,v 1.2 2002/01/25 17:51:31 tv Exp $
# #
# Autoconf definition file for make. # Autoconf definition file for make.
# #
@ -17,4 +17,6 @@ dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
AC_CHECK_LIB(regex, regfree) AC_CHECK_LIB(regex, regfree)
AC_SEARCH_LIBS(regfree, rx posix) AC_SEARCH_LIBS(regfree, rx posix)
AC_CHECK_FUNCS(setenv strdup strerror strftime vsnprintf)
AC_OUTPUT AC_OUTPUT

View File

@ -1,15 +1,15 @@
/* $NetBSD: util.c,v 1.27 2001/12/11 20:37:24 tv Exp $ */ /* $NetBSD: util.c,v 1.28 2002/01/25 17:51:32 tv Exp $ */
/* /*
* Missing stuff from OS's * Missing stuff from OS's
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: util.c,v 1.27 2001/12/11 20:37:24 tv Exp $"; static char rcsid[] = "$NetBSD: util.c,v 1.28 2002/01/25 17:51:32 tv Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: util.c,v 1.27 2001/12/11 20:37:24 tv Exp $"); __RCSID("$NetBSD: util.c,v 1.28 2002/01/25 17:51:32 tv Exp $");
#endif #endif
#endif #endif
@ -24,8 +24,7 @@ __RCSID("$NetBSD: util.c,v 1.27 2001/12/11 20:37:24 tv Exp $");
# endif # endif
#endif #endif
#ifdef sun #if defined(MAKE_BOOTSTRAP) && !defined(HAVE_STRERROR)
extern int errno, sys_nerr; extern int errno, sys_nerr;
extern char *sys_errlist[]; extern char *sys_errlist[];
@ -43,7 +42,7 @@ strerror(e)
} }
#endif #endif
#ifdef ultrix #if defined(MAKE_BOOTSTRAP) && !defined(HAVE_STRDUP)
#include <string.h> #include <string.h>
/* strdup /* strdup
@ -65,11 +64,9 @@ strdup(str)
return memcpy(p, str, len); return memcpy(p, str, len);
} }
#endif #endif
#if defined(sun) || defined(__hpux__) || defined(__sgi) || defined(__hpux) #if defined(MAKE_BOOTSTRAP) && !defined(HAVE_SETENV)
int int
setenv(name, value, dum) setenv(name, value, dum)
const char *name; const char *name;
@ -104,7 +101,6 @@ setenv(name, value, dum)
#endif #endif
#if defined(__hpux__) || defined(__hpux) #if defined(__hpux__) || defined(__hpux)
/* strrcpy(): /* strrcpy():
* Like strcpy, going backwards and returning the new pointer * Like strcpy, going backwards and returning the new pointer
*/ */
@ -157,7 +153,6 @@ char *sys_siglist[] = {
}; };
#endif /* __hpux__ || __hpux */ #endif /* __hpux__ || __hpux */
#ifdef __hpux #ifdef __hpux
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -352,10 +347,9 @@ signal(s, a)) __P((int))
else else
return osa.sa_handler; return osa.sa_handler;
} }
#endif #endif
#if !defined(BSD4_4) && !defined(SUNOS_5_7) && !defined(__linux__) #if defined(MAKE_BOOTSTRAP) && !defined(HAVE_VSNPRINTF)
#ifdef __STDC__ #ifdef __STDC__
#include <stdarg.h> #include <stdarg.h>
#else #else
@ -430,10 +424,7 @@ snprintf(va_alist)
return rv; return rv;
} }
#if !defined(__SVR4) && !defined(__linux__) && !defined(ultrix) \ #if defined(MAKE_BOOTSTRAP) && !defined(HAVE_STRFTIME)
&& !defined(__sgi) && !defined(__osf__) && !defined(__hpux__) \
&& !defined(__CYGWIN__)
int int
strftime(buf, len, fmt, tm) strftime(buf, len, fmt, tm)
char *buf; char *buf;