From 8a02058ab22bd6347d41584394b45a347263c0e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 26 Jun 2007 11:58:21 +0000 Subject: [PATCH] added configure check for wcsdup(), there are too many Unix systems without it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46956 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 109 +++++++++++++++++++++++++++++++++++++---- configure.in | 2 + include/wx/wxcrtbase.h | 2 +- setup.h.in | 3 ++ setup.h_vms | 3 ++ 5 files changed, 109 insertions(+), 10 deletions(-) diff --git a/configure b/configure index e3f9dac2c8..085d5ffc24 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in. +# From configure.in Id: configure.in 46644 2007-06-22 18:06:12Z VZ . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0. # @@ -22968,13 +22968,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -23014,13 +23012,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -34407,6 +34403,101 @@ _ACEOF fi + +for ac_func in wcsdup +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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 +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + if test "$USE_HPUX" = 1 -a "$GCC" != "yes"; then CPPFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CPPFLAGS" fi diff --git a/configure.in b/configure.in index 35a85c33a2..09afd685ee 100644 --- a/configure.in +++ b/configure.in @@ -4468,6 +4468,8 @@ if test "$wxUSE_WCHAR_T" = "yes"; then AC_DEFINE(HAVE_WCSLEN) fi + AC_CHECK_FUNCS([wcsdup]) + dnl On HP-UX aCC need this define to find mbstrtowcs() &c dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict dnl with g++'s in (unless -D_INCLUDE__STDC_A1_SOURCE is in the diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index c93692ff68..07828befe9 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -167,7 +167,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #endif #if defined(__WINDOWS__) #define wxCRT_StrdupW _wcsdup -#elif !defined(__DARWIN__) && !defined( __VMS ) +#elif defined(HAVE_WCSDUP) #define wxCRT_StrdupW wcsdup #endif diff --git a/setup.h.in b/setup.h.in index 92f9264fa1..cc2bebdae8 100644 --- a/setup.h.in +++ b/setup.h.in @@ -912,6 +912,9 @@ /* Define if you have wcslen function */ #undef HAVE_WCSLEN +/* Define if you have wcsdup function */ +#undef HAVE_WCSDUP + /* Define if you have wcstoull() and wcstoll() */ #undef HAVE_WCSTOULL diff --git a/setup.h_vms b/setup.h_vms index 8ce750d464..caa6b39605 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -997,6 +997,9 @@ typedef pid_t GPid; /* Define if you have wcslen function */ #define HAVE_WCSLEN 1 +/* Define if you have wcsdup function */ +#define HAVE_WCSDUP 0 + /* Define if you have wcstoull() and wcstoll() */ #undef HAVE_WCSTOULL -- 2.45.2