diff --git a/icu4c/source/common/unicode/platform.h.in b/icu4c/source/common/unicode/platform.h.in index a7a73424eb..c382591eb5 100644 --- a/icu4c/source/common/unicode/platform.h.in +++ b/icu4c/source/common/unicode/platform.h.in @@ -95,11 +95,14 @@ #define U_DISABLE_RENAMING @U_DISABLE_RENAMING@ #endif -/* Determine whether to disable renaming or not. This overrides the - setting in umachine.h which is for all platforms. */ +/* Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION @U_OVERRIDE_CXX_ALLOCATION@ #endif +/* Determine whether to override placement new and delete for STL. */ +#ifndef U_HAVE_PLACEMENT_NEW +#define U_HAVE_PLACEMENT_NEW @U_HAVE_PLACEMENT_NEW@ +#endif /* Define the library suffix in a C syntax. */ #define U_HAVE_LIB_SUFFIX @U_HAVE_LIB_SUFFIX@ diff --git a/icu4c/source/common/unicode/pwin32.h b/icu4c/source/common/unicode/pwin32.h index c8b4d69dd2..b9059edf6b 100644 --- a/icu4c/source/common/unicode/pwin32.h +++ b/icu4c/source/common/unicode/pwin32.h @@ -58,11 +58,14 @@ /* Determines the endianness of the platform */ #define U_IS_BIG_ENDIAN 0 -/* Determine whether to disable renaming or not. This overrides the - setting in umachine.h which is for all platforms. */ +/* Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION 1 #endif +/* Determine whether to override placement new and delete for STL. */ +#ifndef U_HAVE_PLACEMENT_NEW +#define U_HAVE_PLACEMENT_NEW 0 +#endif /*===========================================================================*/ /* Generic data types */ diff --git a/icu4c/source/common/unicode/uobject.h b/icu4c/source/common/unicode/uobject.h index e51f0c9137..28c4ab380e 100644 --- a/icu4c/source/common/unicode/uobject.h +++ b/icu4c/source/common/unicode/uobject.h @@ -40,6 +40,15 @@ U_NAMESPACE_BEGIN #define U_OVERRIDE_CXX_ALLOCATION 1 #endif +/** U_HAVE_PLACEMENT_NEW - Define this to define the placement new and + * delete in UMemory for STL. + * + * @draft ICU 2.6 + */ +#ifndef U_HAVE_PLACEMENT_NEW +#define U_HAVE_PLACEMENT_NEW 1 +#endif + /** * UMemory is the common ICU base class. * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4). @@ -93,6 +102,7 @@ public: */ static void operator delete[](void *p); +#if U_HAVE_PLACEMENT_NEW /** * Override for ICU4C C++ memory management for STL. * See new(). @@ -106,7 +116,8 @@ public: * @draft ICU 2.6 */ static inline void operator delete(void *, void *) {} -#endif +#endif /* U_HAVE_PLACEMENT_NEW */ +#endif /* U_OVERRIDE_CXX_ALLOCATION */ }; /** diff --git a/icu4c/source/configure b/icu4c/source/configure index 884e51e8ce..81b45b6b16 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -2805,25 +2805,27 @@ fi echo $ac_n "checking for properly overriding new and delete""... $ac_c" 1>&6 echo "configure:2808: checking for properly overriding new and delete" >&5 +U_OVERRIDE_CXX_ALLOCATION=0 +U_HAVE_PLACEMENT_NEW=0 if eval "test \"`echo '$''{'ac_cv_override_cxx_allocation_ok'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < class UObject { void *operator new(size_t size) {return malloc(size);} void *operator new[](size_t size) {return malloc(size);} - void operator delete(void *p) {delete(p);} - void operator delete[](void *p) {delete(p);} + void operator delete(void *p) {free(p);} + void operator delete[](void *p) {free(p);} }; int main() { ; return 0; } EOF -if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_override_cxx_allocation_ok=yes else @@ -2836,11 +2838,50 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_override_cxx_allocation_ok" 1>&6 -U_OVERRIDE_CXX_ALLOCATION=1 -if test $ac_cv_override_cxx_allocation_ok = no +if test $ac_cv_override_cxx_allocation_ok = yes then - U_OVERRIDE_CXX_ALLOCATION=0 + U_OVERRIDE_CXX_ALLOCATION=1 + echo $ac_n "checking for placement new and delete""... $ac_c" 1>&6 +echo "configure:2846: checking for placement new and delete" >&5 + if eval "test \"`echo '$''{'ac_cv_override_placement_new_ok'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < + class UObject { + void *operator new(size_t size) {return malloc(size);} + void *operator new[](size_t size) {return malloc(size);} + void operator delete(void *p) {free(p);} + void operator delete[](void *p) {free(p);} + void * operator new(size_t, void *ptr) { return ptr; } + void operator delete(void *, void *) {} + }; + +int main() { + +; return 0; } +EOF +if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_override_placement_new_ok=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_override_placement_new_ok=no fi +rm -f conftest* +fi + + echo "$ac_t""$ac_cv_override_placement_new_ok" 1>&6 + if test $ac_cv_override_placement_new_ok = yes + then + U_HAVE_PLACEMENT_NEW=1 + fi +fi + ac_ext=c @@ -2851,12 +2892,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for popen""... $ac_c" 1>&6 -echo "configure:2855: checking for popen" >&5 +echo "configure:2896: checking for popen" >&5 if eval "test \"`echo '$''{'ac_cv_func_popen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_popen=yes" else @@ -2907,12 +2948,12 @@ fi echo $ac_n "checking for tzset""... $ac_c" 1>&6 -echo "configure:2911: checking for tzset" >&5 +echo "configure:2952: checking for tzset" >&5 if eval "test \"`echo '$''{'ac_cv_func_tzset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_tzset=yes" else @@ -2959,12 +3000,12 @@ then U_TZSET=tzset else echo $ac_n "checking for _tzset""... $ac_c" 1>&6 -echo "configure:2963: checking for _tzset" >&5 +echo "configure:3004: checking for _tzset" >&5 if eval "test \"`echo '$''{'ac_cv_func__tzset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__tzset=yes" else @@ -3013,12 +3054,12 @@ fi fi echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:3017: checking for tzname" >&5 +echo "configure:3058: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -3048,12 +3089,12 @@ if test $ac_cv_var_tzname = yes; then U_TZNAME=tzname else echo $ac_n "checking for _tzname""... $ac_c" 1>&6 -echo "configure:3052: checking for _tzname" >&5 +echo "configure:3093: checking for _tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var__tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < extern char *_tzname[]; @@ -3062,7 +3103,7 @@ int main() { atoi(*_tzname); ; return 0; } EOF -if { (eval echo configure:3066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var__tzname=yes else @@ -3082,12 +3123,12 @@ fi echo $ac_n "checking for timezone""... $ac_c" 1>&6 -echo "configure:3086: checking for timezone" >&5 +echo "configure:3127: checking for timezone" >&5 if eval "test \"`echo '$''{'ac_cv_var_timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_timezone=yes else @@ -3120,12 +3161,12 @@ if test $ac_cv_var_timezone = yes; then U_HAVE_TIMEZONE=1 else echo $ac_n "checking for __timezone""... $ac_c" 1>&6 -echo "configure:3124: checking for __timezone" >&5 +echo "configure:3165: checking for __timezone" >&5 if eval "test \"`echo '$''{'ac_cv_var___timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3133,7 +3174,7 @@ int main() { __timezone = 1; ; return 0; } EOF -if { (eval echo configure:3137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var___timezone=yes else @@ -3151,12 +3192,12 @@ echo "$ac_t""$ac_cv_var___timezone" 1>&6 U_HAVE_TIMEZONE=1 else echo $ac_n "checking for _timezone""... $ac_c" 1>&6 -echo "configure:3155: checking for _timezone" >&5 +echo "configure:3196: checking for _timezone" >&5 if eval "test \"`echo '$''{'ac_cv_var__timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3164,7 +3205,7 @@ int main() { _timezone = 1; ; return 0; } EOF -if { (eval echo configure:3168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var__timezone=yes else @@ -3187,12 +3228,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3191: checking for ANSI C header files" >&5 +echo "configure:3232: 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 < #include @@ -3200,7 +3241,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3245: \"$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* @@ -3217,7 +3258,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 @@ -3235,7 +3276,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 @@ -3256,7 +3297,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3267,7 +3308,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3291,12 +3332,12 @@ EOF fi echo $ac_n "checking for int8_t""... $ac_c" 1>&6 -echo "configure:3295: checking for int8_t" >&5 +echo "configure:3336: checking for int8_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_int8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3324,12 +3365,12 @@ EOF fi echo $ac_n "checking for uint8_t""... $ac_c" 1>&6 -echo "configure:3328: checking for uint8_t" >&5 +echo "configure:3369: checking for uint8_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3357,12 +3398,12 @@ EOF fi echo $ac_n "checking for int16_t""... $ac_c" 1>&6 -echo "configure:3361: checking for int16_t" >&5 +echo "configure:3402: checking for int16_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3390,12 +3431,12 @@ EOF fi echo $ac_n "checking for uint16_t""... $ac_c" 1>&6 -echo "configure:3394: checking for uint16_t" >&5 +echo "configure:3435: checking for uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3423,12 +3464,12 @@ EOF fi echo $ac_n "checking for int32_t""... $ac_c" 1>&6 -echo "configure:3427: checking for int32_t" >&5 +echo "configure:3468: checking for int32_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3456,12 +3497,12 @@ EOF fi echo $ac_n "checking for uint32_t""... $ac_c" 1>&6 -echo "configure:3460: checking for uint32_t" >&5 +echo "configure:3501: checking for uint32_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3489,12 +3530,12 @@ EOF fi echo $ac_n "checking for int64_t""... $ac_c" 1>&6 -echo "configure:3493: checking for int64_t" >&5 +echo "configure:3534: checking for int64_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_int64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3522,12 +3563,12 @@ EOF fi echo $ac_n "checking for uint64_t""... $ac_c" 1>&6 -echo "configure:3526: checking for uint64_t" >&5 +echo "configure:3567: checking for uint64_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3613,17 +3654,17 @@ fi ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for wchar.h""... $ac_c" 1>&6 -echo "configure:3617: checking for wchar.h" >&5 +echo "configure:3658: checking for wchar.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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3668: \"$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* @@ -3656,14 +3697,14 @@ EOF U_HAVE_WCHAR_H=1 echo $ac_n "checking for library containing wcscpy""... $ac_c" 1>&6 -echo "configure:3660: checking for library containing wcscpy" >&5 +echo "configure:3701: checking for library containing wcscpy" >&5 if eval "test \"`echo '$''{'ac_cv_search_wcscpy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_wcscpy="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_wcscpy="none required" else @@ -3685,7 +3726,7 @@ rm -f conftest* test "$ac_cv_search_wcscpy" = "no" && for i in wcs w; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_wcscpy="-l$i" break @@ -3727,7 +3768,7 @@ fi ac_default_sizeof_wchar_t=4 echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6 -echo "configure:3731: checking size of wchar_t" >&5 +echo "configure:3772: checking size of wchar_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_wchar_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3735,7 +3776,7 @@ else ac_cv_sizeof_wchar_t=$ac_default_sizeof_wchar_t else cat > conftest.$ac_ext < @@ -3753,7 +3794,7 @@ main() exit(0); } EOF -if { (eval echo configure:3757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_wchar_t=`cat conftestval` else @@ -3935,7 +3976,7 @@ esac echo $ac_n "checking for a library suffix to use""... $ac_c" 1>&6 -echo "configure:3939: checking for a library suffix to use" >&5 +echo "configure:3980: checking for a library suffix to use" >&5 # Check whether --with-library-suffix or --without-library-suffix was given. if test "${with_library_suffix+set}" = set; then withval="$with_library_suffix" @@ -4310,6 +4351,7 @@ s%@U_HAVE_NL_LANGINFO_CODESET@%$U_HAVE_NL_LANGINFO_CODESET%g s%@U_NL_LANGINFO_CODESET@%$U_NL_LANGINFO_CODESET%g s%@U_HAVE_NAMESPACE@%$U_HAVE_NAMESPACE%g s%@U_OVERRIDE_CXX_ALLOCATION@%$U_OVERRIDE_CXX_ALLOCATION%g +s%@U_HAVE_PLACEMENT_NEW@%$U_HAVE_PLACEMENT_NEW%g s%@U_HAVE_POPEN@%$U_HAVE_POPEN%g s%@U_TZSET@%$U_TZSET%g s%@U_TZNAME@%$U_TZNAME%g diff --git a/icu4c/source/configure.in b/icu4c/source/configure.in index 43228a322e..bb1c2fd1fb 100644 --- a/icu4c/source/configure.in +++ b/icu4c/source/configure.in @@ -4,7 +4,7 @@ dnl Copyright (c) 1999-2000, International Business Machines Corporation and dnl others. All Rights Reserved. dnl Stephen F. Booth, heavily modified by Yves and others -dnl $Id: configure.in,v 1.177 2002/11/01 19:12:24 grhoten-oss Exp $ +dnl $Id: configure.in,v 1.178 2003/02/15 00:23:27 grhoten-oss Exp $ dnl Process this file with autoconf to produce a configure script AC_INIT(common/unicode/utypes.h) @@ -399,6 +399,8 @@ fi AC_SUBST(U_HAVE_NAMESPACE) AC_MSG_CHECKING([for properly overriding new and delete]) +U_OVERRIDE_CXX_ALLOCATION=0 +U_HAVE_PLACEMENT_NEW=0 AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok, [AC_TRY_LINK( changequote(<<, >>)dnl @@ -406,19 +408,40 @@ AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok, class UObject { void *operator new(size_t size) {return malloc(size);} void *operator new[](size_t size) {return malloc(size);} - void operator delete(void *p) {delete(p);} - void operator delete[](void *p) {delete(p);} + void operator delete(void *p) {free(p);} + void operator delete[](void *p) {free(p);} }; >>, changequote([, ])dnl [], ac_cv_override_cxx_allocation_ok=yes, ac_cv_override_cxx_allocation_ok=no)] ) AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok) -U_OVERRIDE_CXX_ALLOCATION=1 -if test $ac_cv_override_cxx_allocation_ok = no +if test $ac_cv_override_cxx_allocation_ok = yes then - U_OVERRIDE_CXX_ALLOCATION=0 + U_OVERRIDE_CXX_ALLOCATION=1 + AC_MSG_CHECKING([for placement new and delete]) + AC_CACHE_VAL(ac_cv_override_placement_new_ok, + [AC_TRY_LINK( + changequote(<<, >>)dnl + <<#include + class UObject { + void *operator new(size_t size) {return malloc(size);} + void *operator new[](size_t size) {return malloc(size);} + void operator delete(void *p) {free(p);} + void operator delete[](void *p) {free(p);} + void * operator new(size_t, void *ptr) { return ptr; } + void operator delete(void *, void *) {} + }; + >>, + changequote([, ])dnl + [], ac_cv_override_placement_new_ok=yes, ac_cv_override_placement_new_ok=no)] ) + AC_MSG_RESULT($ac_cv_override_placement_new_ok) + if test $ac_cv_override_placement_new_ok = yes + then + U_HAVE_PLACEMENT_NEW=1 + fi fi AC_SUBST(U_OVERRIDE_CXX_ALLOCATION) +AC_SUBST(U_HAVE_PLACEMENT_NEW) AC_LANG_C AC_CHECK_FUNC(popen)