mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
Makefile.in (CFILES): Add putenv.c and setenv.c.
* Makefile.in (CFILES): Add putenv.c and setenv.c. * configure.in (funcs): Add putenv and setenv. (AC_CHECK_FUNCS): Check for putenv and setenv. * configure: Rebuilt. * putenv.c setenv.c: New files. [[Split portion of a mixed commit.]] From-SVN: r27162.2
This commit is contained in:
parent
d05ba2205f
commit
9eb4080f6f
@ -120,9 +120,9 @@ CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \
|
||||
fnmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \
|
||||
getruntime.c floatformat.c hex.c index.c insque.c memchr.c \
|
||||
memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c \
|
||||
pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \
|
||||
splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c strerror.c \
|
||||
strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \
|
||||
pexecute.c putenv.c random.c rename.c rindex.c setenv.c sigsetmask.c \
|
||||
spaces.c splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c \
|
||||
strerror.c strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \
|
||||
tmpnam.c vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
|
||||
waitpid.c xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
|
||||
|
||||
|
138
libiberty/configure
vendored
138
libiberty/configure
vendored
@ -1159,9 +1159,11 @@ funcs="$funcs memcpy"
|
||||
funcs="$funcs memmove"
|
||||
funcs="$funcs memset"
|
||||
funcs="$funcs mkstemps"
|
||||
funcs="$funcs putenv"
|
||||
funcs="$funcs random"
|
||||
funcs="$funcs rename"
|
||||
funcs="$funcs rindex"
|
||||
funcs="$funcs setenv"
|
||||
funcs="$funcs sigsetmask"
|
||||
funcs="$funcs strcasecmp"
|
||||
funcs="$funcs strchr"
|
||||
@ -1191,12 +1193,12 @@ if test "x" = "y"; then
|
||||
for ac_func in asprintf atexit basename bcmp bcopy bzero calloc clock getcwd
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1195: checking for $ac_func" >&5
|
||||
echo "configure:1197: 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 1200 "configure"
|
||||
#line 1202 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1219,7 +1221,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1225: \"$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
|
||||
@ -1246,12 +1248,12 @@ done
|
||||
for ac_func in getpagesize index insque mkstemps memchr memcmp memcpy memmove
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1250: checking for $ac_func" >&5
|
||||
echo "configure:1252: 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 1255 "configure"
|
||||
#line 1257 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1274,7 +1276,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1280: \"$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
|
||||
@ -1298,15 +1300,15 @@ else
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in memset random rename rindex sigsetmask strcasecmp
|
||||
for ac_func in memset putenv random rename rindex sigsetmask strcasecmp
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1305: checking for $ac_func" >&5
|
||||
echo "configure:1307: 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 1310 "configure"
|
||||
#line 1312 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1329,7 +1331,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1335: \"$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
|
||||
@ -1353,15 +1355,15 @@ else
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in strchr strdup strncasecmp strrchr strstr strtod strtol
|
||||
for ac_func in setenv strchr strdup strncasecmp strrchr strstr strtod strtol
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1360: checking for $ac_func" >&5
|
||||
echo "configure:1362: 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 1365 "configure"
|
||||
#line 1367 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1384,7 +1386,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1390: \"$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
|
||||
@ -1411,12 +1413,12 @@ done
|
||||
for ac_func in strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1415: checking for $ac_func" >&5
|
||||
echo "configure:1417: 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 1420 "configure"
|
||||
#line 1422 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1439,7 +1441,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1445: \"$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
|
||||
@ -1478,12 +1480,12 @@ EOF
|
||||
for ac_func in getrusage on_exit psignal strerror strsignal sysconf times
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1482: checking for $ac_func" >&5
|
||||
echo "configure:1484: 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 1487 "configure"
|
||||
#line 1489 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1506,7 +1508,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1512: \"$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
|
||||
@ -1533,12 +1535,12 @@ done
|
||||
for ac_func in sbrk
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1537: checking for $ac_func" >&5
|
||||
echo "configure:1539: 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 1542 "configure"
|
||||
#line 1544 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1561,7 +1563,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1567: \"$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
|
||||
@ -1732,7 +1734,7 @@ EOF
|
||||
# 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:1736: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
|
||||
echo "configure:1738: 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.
|
||||
@ -1743,12 +1745,12 @@ cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
|
||||
#line 1747 "configure"
|
||||
#line 1749 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
main(){return(0);}
|
||||
EOF
|
||||
if { (eval echo configure:1752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1754: \"$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
|
||||
@ -1774,19 +1776,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:1778: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
|
||||
echo "configure:1780: 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:1785: checking for $ac_func" >&5
|
||||
echo "configure:1787: 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 1790 "configure"
|
||||
#line 1792 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1809,7 +1811,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1815: \"$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
|
||||
@ -1856,19 +1858,19 @@ 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:1860: checking for working alloca.h" >&5
|
||||
echo "configure:1862: 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 1865 "configure"
|
||||
#line 1867 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <alloca.h>
|
||||
int main() {
|
||||
char *p = alloca(2 * sizeof(int));
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1874: \"$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
|
||||
@ -1889,12 +1891,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for alloca""... $ac_c" 1>&6
|
||||
echo "configure:1893: checking for alloca" >&5
|
||||
echo "configure:1895: 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 1898 "configure"
|
||||
#line 1900 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -1922,7 +1924,7 @@ int main() {
|
||||
char *p = (char *) alloca(1);
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1928: \"$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
|
||||
@ -1954,12 +1956,12 @@ EOF
|
||||
|
||||
|
||||
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
|
||||
echo "configure:1958: checking whether alloca needs Cray hooks" >&5
|
||||
echo "configure:1960: 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 1963 "configure"
|
||||
#line 1965 "configure"
|
||||
#include "confdefs.h"
|
||||
#if defined(CRAY) && ! defined(CRAY2)
|
||||
webecray
|
||||
@ -1984,12 +1986,12 @@ 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:1988: checking for $ac_func" >&5
|
||||
echo "configure:1990: 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 1993 "configure"
|
||||
#line 1995 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -2012,7 +2014,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2018: \"$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
|
||||
@ -2039,7 +2041,7 @@ done
|
||||
fi
|
||||
|
||||
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
|
||||
echo "configure:2043: checking stack direction for C alloca" >&5
|
||||
echo "configure:2045: 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
|
||||
@ -2047,7 +2049,7 @@ else
|
||||
ac_cv_c_stack_direction=0
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2051 "configure"
|
||||
#line 2053 "configure"
|
||||
#include "confdefs.h"
|
||||
find_stack_direction ()
|
||||
{
|
||||
@ -2066,7 +2068,7 @@ main ()
|
||||
exit (find_stack_direction() < 0);
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:2070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:2072: \"$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
|
||||
@ -2091,12 +2093,12 @@ fi
|
||||
esac
|
||||
|
||||
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
|
||||
echo "configure:2095: checking for ANSI C header files" >&5
|
||||
echo "configure:2097: 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 2100 "configure"
|
||||
#line 2102 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@ -2104,7 +2106,7 @@ else
|
||||
#include <float.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2108: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:2110: \"$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*
|
||||
@ -2121,7 +2123,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 2125 "configure"
|
||||
#line 2127 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <string.h>
|
||||
EOF
|
||||
@ -2139,7 +2141,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 2143 "configure"
|
||||
#line 2145 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
EOF
|
||||
@ -2160,7 +2162,7 @@ if test "$cross_compiling" = yes; then
|
||||
:
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2164 "configure"
|
||||
#line 2166 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <ctype.h>
|
||||
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
|
||||
@ -2171,7 +2173,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
|
||||
exit (0); }
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:2175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:2177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
@ -2195,12 +2197,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
|
||||
echo "configure:2199: checking for pid_t" >&5
|
||||
echo "configure:2201: 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 2204 "configure"
|
||||
#line 2206 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -2229,17 +2231,17 @@ fi
|
||||
|
||||
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
|
||||
echo "configure:2233: checking for vfork.h" >&5
|
||||
echo "configure:2235: 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 2238 "configure"
|
||||
#line 2240 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <vfork.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:2245: \"$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*
|
||||
@ -2264,18 +2266,18 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
|
||||
echo "configure:2268: checking for working vfork" >&5
|
||||
echo "configure:2270: 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:2274: checking for vfork" >&5
|
||||
echo "configure:2276: 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 2279 "configure"
|
||||
#line 2281 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char vfork(); below. */
|
||||
@ -2298,7 +2300,7 @@ vfork();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2304: \"$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
|
||||
@ -2320,7 +2322,7 @@ fi
|
||||
ac_cv_func_vfork_works=$ac_cv_func_vfork
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2324 "configure"
|
||||
#line 2326 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Thanks to Paul Eggert for this test. */
|
||||
#include <stdio.h>
|
||||
@ -2415,7 +2417,7 @@ main() {
|
||||
}
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:2419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:2421: \"$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
|
||||
@ -2442,19 +2444,19 @@ fi
|
||||
fi
|
||||
for v in $vars; do
|
||||
echo $ac_n "checking for $v""... $ac_c" 1>&6
|
||||
echo "configure:2446: checking for $v" >&5
|
||||
echo "configure:2448: 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 2451 "configure"
|
||||
#line 2453 "configure"
|
||||
#include "confdefs.h"
|
||||
int *p;
|
||||
int main() {
|
||||
extern int $v; p = &$v;
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2460: \"$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
|
||||
@ -2480,12 +2482,12 @@ EOF
|
||||
for ac_func in $checkfuncs
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:2484: checking for $ac_func" >&5
|
||||
echo "configure:2486: 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 2489 "configure"
|
||||
#line 2491 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -2508,7 +2510,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2514: \"$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
|
||||
|
@ -130,9 +130,11 @@ funcs="$funcs memcpy"
|
||||
funcs="$funcs memmove"
|
||||
funcs="$funcs memset"
|
||||
funcs="$funcs mkstemps"
|
||||
funcs="$funcs putenv"
|
||||
funcs="$funcs random"
|
||||
funcs="$funcs rename"
|
||||
funcs="$funcs rindex"
|
||||
funcs="$funcs setenv"
|
||||
funcs="$funcs sigsetmask"
|
||||
funcs="$funcs strcasecmp"
|
||||
funcs="$funcs strchr"
|
||||
@ -161,8 +163,8 @@ checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk"
|
||||
if test "x" = "y"; then
|
||||
AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero calloc clock getcwd)
|
||||
AC_CHECK_FUNCS(getpagesize index insque mkstemps memchr memcmp memcpy memmove)
|
||||
AC_CHECK_FUNCS(memset random rename rindex sigsetmask strcasecmp)
|
||||
AC_CHECK_FUNCS(strchr strdup strncasecmp strrchr strstr strtod strtol)
|
||||
AC_CHECK_FUNCS(memset putenv random rename rindex sigsetmask strcasecmp)
|
||||
AC_CHECK_FUNCS(setenv strchr strdup strncasecmp strrchr strstr strtod strtol)
|
||||
AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid)
|
||||
AC_DEFINE(HAVE_SYS_ERRLIST)
|
||||
AC_DEFINE(HAVE_SYS_NERR)
|
||||
|
66
libiberty/putenv.c
Normal file
66
libiberty/putenv.c
Normal file
@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file based on putenv.c in the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if defined (_AIX) && !defined (__GNUC__)
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
#else
|
||||
# ifndef alloca
|
||||
# ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# else
|
||||
extern char *alloca ();
|
||||
# endif /* __GNUC__ */
|
||||
# endif /* alloca */
|
||||
#endif /* HAVE_ALLOCA_H */
|
||||
|
||||
/* Below this point, it's verbatim code from the glibc-2.0 implementation */
|
||||
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
|
||||
int
|
||||
putenv (string)
|
||||
const char *string;
|
||||
{
|
||||
const char *const name_end = strchr (string, '=');
|
||||
|
||||
if (name_end)
|
||||
{
|
||||
char *name = alloca (name_end - string + 1);
|
||||
memcpy (name, string, name_end - string);
|
||||
name[name_end - string] = '\0';
|
||||
return setenv (name, name_end + 1, 1);
|
||||
}
|
||||
|
||||
unsetenv (string);
|
||||
return 0;
|
||||
}
|
159
libiberty/setenv.c
Normal file
159
libiberty/setenv.c
Normal file
@ -0,0 +1,159 @@
|
||||
/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file based on setenv.c in the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#if !defined(errno) && !defined(HAVE_ERRNO_DECL)
|
||||
extern int errno;
|
||||
#endif
|
||||
#define __set_errno(ev) ((errno) = (ev))
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define __environ environ
|
||||
#ifndef HAVE_ENVIRON_DECL
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
/* LOCK and UNLOCK are defined as no-ops. This makes the libiberty
|
||||
* implementation MT-Unsafe. */
|
||||
#define LOCK
|
||||
#define UNLOCK
|
||||
|
||||
/* Below this point, it's verbatim code from the glibc-2.0 implementation */
|
||||
|
||||
/* If this variable is not a null pointer we allocated the current
|
||||
environment. */
|
||||
static char **last_environ;
|
||||
|
||||
|
||||
int
|
||||
setenv (name, value, replace)
|
||||
const char *name;
|
||||
const char *value;
|
||||
int replace;
|
||||
{
|
||||
register char **ep;
|
||||
register size_t size;
|
||||
const size_t namelen = strlen (name);
|
||||
const size_t vallen = strlen (value) + 1;
|
||||
|
||||
LOCK;
|
||||
|
||||
size = 0;
|
||||
if (__environ != NULL)
|
||||
for (ep = __environ; *ep != NULL; ++ep)
|
||||
if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
|
||||
break;
|
||||
else
|
||||
++size;
|
||||
|
||||
if (__environ == NULL || *ep == NULL)
|
||||
{
|
||||
char **new_environ;
|
||||
if (__environ == last_environ && __environ != NULL)
|
||||
/* We allocated this space; we can extend it. */
|
||||
new_environ = (char **) realloc (last_environ,
|
||||
(size + 2) * sizeof (char *));
|
||||
else
|
||||
new_environ = (char **) malloc ((size + 2) * sizeof (char *));
|
||||
|
||||
if (new_environ == NULL)
|
||||
{
|
||||
UNLOCK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
new_environ[size] = malloc (namelen + 1 + vallen);
|
||||
if (new_environ[size] == NULL)
|
||||
{
|
||||
free ((char *) new_environ);
|
||||
__set_errno (ENOMEM);
|
||||
UNLOCK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (__environ != last_environ)
|
||||
memcpy ((char *) new_environ, (char *) __environ,
|
||||
size * sizeof (char *));
|
||||
|
||||
memcpy (new_environ[size], name, namelen);
|
||||
new_environ[size][namelen] = '=';
|
||||
memcpy (&new_environ[size][namelen + 1], value, vallen);
|
||||
|
||||
new_environ[size + 1] = NULL;
|
||||
|
||||
last_environ = __environ = new_environ;
|
||||
}
|
||||
else if (replace)
|
||||
{
|
||||
size_t len = strlen (*ep);
|
||||
if (len + 1 < namelen + 1 + vallen)
|
||||
{
|
||||
/* The existing string is too short; malloc a new one. */
|
||||
char *new = malloc (namelen + 1 + vallen);
|
||||
if (new == NULL)
|
||||
{
|
||||
UNLOCK;
|
||||
return -1;
|
||||
}
|
||||
*ep = new;
|
||||
}
|
||||
memcpy (*ep, name, namelen);
|
||||
(*ep)[namelen] = '=';
|
||||
memcpy (&(*ep)[namelen + 1], value, vallen);
|
||||
}
|
||||
|
||||
UNLOCK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
unsetenv (name)
|
||||
const char *name;
|
||||
{
|
||||
const size_t len = strlen (name);
|
||||
char **ep;
|
||||
|
||||
LOCK;
|
||||
|
||||
for (ep = __environ; *ep; ++ep)
|
||||
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
|
||||
{
|
||||
/* Found it. Remove this pointer by moving later ones back. */
|
||||
char **dp = ep;
|
||||
do
|
||||
dp[0] = dp[1];
|
||||
while (*dp++);
|
||||
/* Continue the loop in case NAME appears again. */
|
||||
}
|
||||
|
||||
UNLOCK;
|
||||
}
|
Loading…
Reference in New Issue
Block a user