Commit 176cbd0b authored by Ondrej Sury's avatar Ondrej Sury

Imported Upstream version 5.2.12.dfsg.1

parent 10544de9
......@@ -206,7 +206,7 @@ STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_pgsql
PRIMARY MAINTAINER: Unknown
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
......
......@@ -82,26 +82,21 @@ PHP_TEST_SHARED_EXTENSIONS = ` \
test: all
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -d extension_dir=modules/ $(PHP_TEST_SHARED_EXTENSIONS) tests/; \
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
INI_FILE=`$(top_builddir)/$(SAPI_CLI_PATH) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
if test "$$INI_FILE"; then \
$(EGREP) -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
else \
echo > $(top_builddir)/tmp-php.ini; \
fi; \
INI_SCANNED_PATH=`$(top_builddir)/$(SAPI_CLI_PATH) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
if test "$$INI_SCANNED_PATH"; then \
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
$(EGREP) -h -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
......
This diff is collapsed.
......@@ -8,6 +8,4 @@ $foo[3]->bar[1] = "bang";
echo "ok\n";
?>
--EXPECTF--
Notice: Uninitialized string offset: 3 in %s on line %d
Fatal error: Cannot use string offset as an object in %sbug41919.php on line %d
--TEST--
Bug #49472 (Constants defined in Interfaces can be overridden)
--FILE--
<?php
interface ia {
const c = 'Sea';
const y = 2;
}
class Foo implements ia {
}
class FooBar extends Foo implements ia {
const x = 1;
const c = 'Ocean';
public function show() {
return ia::c;
}
}
new FooBar;
?>
--EXPECTF--
Fatal error: Cannot inherit previously-inherited or override constant c from interface ia in %s on line %d
--TEST--
Bug #50005 (Throwing through Reflection modified Exception object makes segmentation fault)
--FILE--
<?php
class a extends exception {
public function __construct() {
$this->file = null;
}
}
throw new a;
?>
--EXPECTF--
Fatal error: Uncaught exception 'a' in :%d
Stack trace:
#0 {main}
thrown in Unknown on line %d
--TEST--
Bug #50174 (Incorrectly matched docComment)
--SKIPIF--
<?php if (!extension_loaded('reflection') || !extension_loaded('spl')) print "skip"; ?>
--FILE--
<?php
class TestClass
{
/** const comment */
const C = 0;
function x() {}
}
$rm = new ReflectionMethod('TestClass', 'x');
var_dump($rm->getDocComment());
class TestClass2
{
/** const comment */
const C = 0;
public $x;
}
$rp = new ReflectionProperty('TestClass2', 'x');
var_dump($rp->getDocComment());
?>
--EXPECT--
bool(false)
bool(false)
--TEST--
Bug #50255 (isset() and empty() silently casts array to object)
--FILE--
<?php
$arr = array('foo' => 'bar');
print "isset\n";
var_dump(isset($arr->foo));
var_dump(isset($arr->bar));
var_dump(isset($arr['foo']));
var_dump(isset($arr['bar']));
print "empty\n";
var_dump(empty($arr->foo));
var_dump(empty($arr->bar));
var_dump(empty($arr['foo']));
var_dump(empty($arr['bar']));
?>
--EXPECT--
isset
bool(false)
bool(false)
bool(true)
bool(false)
empty
bool(true)
bool(true)
bool(false)
bool(true)
......@@ -16,5 +16,5 @@ class test implements test1, test2 {
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot inherit previously-inherited constant FOO from interface test2 in %s on line %d
--EXPECTF--
Fatal error: Cannot inherit previously-inherited or override constant FOO from interface test2 in %s on line %d
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_compile.c 280170 2009-05-08 17:50:58Z mattwil $ */
/* $Id: zend_compile.c 291642 2009-12-03 12:34:50Z felipe $ */
#include <zend_language_parser.h>
#include "zend.h"
......@@ -2333,20 +2333,28 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
}
static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zval **parent_constant, zend_hash_key *hash_key, zend_class_entry *iface)
{
zval **old_constant;
if (zend_hash_quick_find(child_constants_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) {
if (*old_constant != *parent_constant) {
zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %s from interface %s", hash_key->arKey, iface->name);
if (*old_constant != *parent_constant) {
zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", hash_key->arKey, iface->name);
}
return 0;
}
return 1;
}
static int do_interface_constant_check(zval **val, int num_args, va_list args, zend_hash_key *key) /* {{{ */
{
zend_class_entry **iface = va_arg(args, zend_class_entry**);
do_inherit_constant_check(&(*iface)->constants_table, val, key, *iface);
return ZEND_HASH_APPLY_KEEP;
}
/* }}} */
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC)
{
......@@ -2366,7 +2374,10 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry
}
}
}
if (!ignore) {
if (ignore) {
/* Check for attempt to redeclare interface constants */
zend_hash_apply_with_arguments(&ce->constants_table, (apply_func_args_t) do_interface_constant_check, 1, &iface);
} else {
if (ce->num_interfaces >= current_iface_num) {
if (ce->type == ZEND_INTERNAL_CLASS) {
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
......@@ -3103,6 +3114,12 @@ void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC)
zend_error(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val);
}
FREE_PNODE(var_name);
if (CG(doc_comment)) {
efree(CG(doc_comment));
CG(doc_comment) = NULL;
CG(doc_comment_len) = 0;
}
}
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_execute.c 278340 2009-04-06 23:56:20Z felipe $ */
/* $Id: zend_execute.c 288525 2009-09-21 13:32:10Z dmitry $ */
#define ZEND_INTENSIVE_DEBUGGING 0
......@@ -1132,7 +1132,8 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
break;
}
if (result) {
if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
if ((Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) &&
(type == BP_VAR_R || type == BP_VAR_IS)) {
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
}
container = *container_ptr;
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_execute_API.c 288345 2009-09-15 00:09:13Z moriyoshi $ */
/* $Id: zend_execute_API.c 290231 2009-11-05 09:33:19Z dmitry $ */
#include <stdio.h>
#include <signal.h>
......@@ -1511,7 +1511,7 @@ void zend_unset_timeout(TSRMLS_D)
}
#else
# ifdef HAVE_SETITIMER
{
if (EG(timeout_seconds)) {
struct itimerval no_timeout;
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_objects.c 272374 2008-12-31 11:17:49Z sebastian $ */
/* $Id: zend_objects.c 289581 2009-10-12 17:09:11Z felipe $ */
#include "zend.h"
#include "zend_globals.h"
......@@ -49,7 +49,7 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
{
zend_function *destructor = object->ce->destructor;
zend_function *destructor = object ? object->ce->destructor : NULL;
if (destructor) {
zval *obj;
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_operators.c 276004 2009-02-17 15:15:36Z mattwil $ */
/* $Id: zend_operators.c 291172 2009-11-23 04:12:36Z iliaa $ */
#include <ctype.h>
......@@ -1202,6 +1202,12 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
}
if (result==op1) { /* special case, perform operations on result */
uint res_len = op1->value.str.len + op2->value.str.len;
if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) {
efree(Z_STRVAL_P(result));
ZVAL_EMPTY_STRING(result);
zend_error(E_ERROR, "String size overflow");
}
result->value.str.val = erealloc(result->value.str.val, res_len+1);
......
......@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_vm_def.h 287466 2009-08-18 20:51:49Z stas $ */
/* $Id: zend_vm_def.h 291282 2009-11-24 21:54:12Z felipe $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
......@@ -939,6 +939,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
FREE_OP1();
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
......@@ -3531,7 +3532,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
zend_free_op free_op2;
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......
......@@ -1531,6 +1531,7 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
......@@ -4111,6 +4112,7 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
......@@ -7166,6 +7168,7 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
......@@ -9747,7 +9750,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim,
zval *offset = &opline->op2.u.constant;
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -11280,7 +11283,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -12861,7 +12864,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -14887,7 +14890,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN
zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -16006,7 +16009,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di
zval *offset = &opline->op2.u.constant;
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -16999,7 +17002,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim,
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -17992,7 +17995,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim,
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -19253,7 +19256,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim,
zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -19600,6 +19603,7 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
......@@ -22014,7 +22018,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z
zval *offset = &opline->op2.u.constant;
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -23539,7 +23543,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -25111,7 +25115,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......@@ -27127,7 +27131,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND
zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
......
dnl
dnl $Id: acinclude.m4 287126 2009-08-11 23:45:35Z srinatar $
dnl $Id: acinclude.m4 291414 2009-11-29 06:13:22Z rasmus $
dnl
dnl This file contains local autoconf functions.
dnl
......@@ -1688,7 +1688,7 @@ dnl PHP_BROKEN_GLIBC_FOPEN_APPEND
dnl
AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [
AC_MSG_CHECKING([for broken libc stdio])
AC_CACHE_VAL(have_broken_glibc_fopen_append,[
AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[
AC_TRY_RUN([
#include <stdio.h>
int main(int argc, char *argv[])
......@@ -1714,8 +1714,8 @@ int main(int argc, char *argv[])
return 0;
}
],
[have_broken_glibc_fopen_append=no],
[have_broken_glibc_fopen_append=yes ],
[_cv_have_broken_glibc_fopen_append=no],
[_cv_have_broken_glibc_fopen_append=yes ],
AC_TRY_COMPILE([
#include <features.h>
],[
......@@ -1723,11 +1723,11 @@ AC_TRY_COMPILE([
choke me
#endif
],
[have_broken_glibc_fopen_append=yes],
[have_broken_glibc_fopen_append=no ])
[_cv_have_broken_glibc_fopen_append=yes],
[_cv_have_broken_glibc_fopen_append=no ])
)])
if test "$have_broken_glibc_fopen_append" = "yes"; then
if test "$_cv_have_broken_glibc_fopen_append" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
else
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2005-08-03'
timestamp='2008-01-23'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -55,8 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
......@@ -106,7 +107,7 @@ set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
......@@ -160,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
......@@ -206,8 +208,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
......@@ -325,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:*)
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
......@@ -527,7 +532,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[45])
*:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
......@@ -764,12 +769,19 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
case ${UNAME_MACHINE} in
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
i*:MINGW*:*)
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:windows32*:*)
......@@ -779,9 +791,18 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
......@@ -815,6 +836,16 @@ EOF
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
......@@ -851,7 +882,11 @@ EOF
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
......@@ -870,7 +905,11 @@ EOF
#endif