diff --git a/ChangeLog b/ChangeLog index cb0a5eaa7..7a290855f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-02-25 Richard Frith-Macdonald + + * configure.ac: + * configure: + * Headers/Additions/GNUstepBase/config.h.in: + * Source/NSString.m: + Update printf handling for very latest glibc + 2010-02-25 Richard Frith-Macdonald * configure.ac: Add test for socklen_t type diff --git a/Headers/Additions/GNUstepBase/config.h.in b/Headers/Additions/GNUstepBase/config.h.in index 56d49ed87..0cf74f766 100644 --- a/Headers/Additions/GNUstepBase/config.h.in +++ b/Headers/Additions/GNUstepBase/config.h.in @@ -262,6 +262,9 @@ /* Define if you have the register_printf_function function */ #undef HAVE_REGISTER_PRINTF_FUNCTION +/* Define to 1 if you have the `register_printf_specifier' function. */ +#undef HAVE_REGISTER_PRINTF_SPECIFIER + /* Define to 1 if you have the `rint' function. */ #undef HAVE_RINT @@ -492,31 +495,31 @@ /* Define to 1 if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID -/* The size of a `double', as computed by sizeof. */ +/* The size of `double', as computed by sizeof. */ #undef SIZEOF_DOUBLE -/* The size of a `float', as computed by sizeof. */ +/* The size of `float', as computed by sizeof. */ #undef SIZEOF_FLOAT -/* The size of a `int', as computed by sizeof. */ +/* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of a `long long', as computed by sizeof. */ +/* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG -/* The size of a `pthread_cond_t', as computed by sizeof. */ +/* The size of `pthread_cond_t', as computed by sizeof. */ #undef SIZEOF_PTHREAD_COND_T -/* The size of a `pthread_mutex_t', as computed by sizeof. */ +/* The size of `pthread_mutex_t', as computed by sizeof. */ #undef SIZEOF_PTHREAD_MUTEX_T -/* The size of a `short', as computed by sizeof. */ +/* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT -/* The size of a `void*', as computed by sizeof. */ +/* The size of `void*', as computed by sizeof. */ #undef SIZEOF_VOIDP /* Define to 1 if you have the ANSI C header files. */ @@ -544,5 +547,5 @@ #undef inline #endif -/* Define to `unsigned' if does not define. */ +/* Define to `unsigned int' if does not define. */ #undef size_t diff --git a/Source/NSString.m b/Source/NSString.m index 50535650c..000084f80 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -478,7 +478,11 @@ static const unichar byteOrderMarkSwapped = 0xFFFE; #if ! PRINTF_ATSIGN_VA_LIST static int -arginfo_func (const struct printf_info *info, size_t n, int *argtypes) +arginfo_func (const struct printf_info *info, size_t n, int *argtypes +#if defined(HAVE_REGISTER_PRINTF_SPECIFIER) +, int *size +#endif +) { *argtypes = PA_POINTER; return 1; @@ -584,9 +588,8 @@ handle_printf_atsign (FILE *stream, NSNonRetainedObjectMapValueCallBacks, 0); placeholderLock = [NSLock new]; -#ifdef HAVE_REGISTER_PRINTF_FUNCTION - if (register_printf_function ('@', - handle_printf_atsign, +#if defined(HAVE_REGISTER_PRINTF_SPECIFIER) + if (register_printf_specifier ('@', handle_printf_atsign, #if PRINTF_ATSIGN_VA_LIST 0)) #else @@ -594,7 +597,16 @@ handle_printf_atsign (FILE *stream, #endif [NSException raise: NSGenericException format: @"register printf handling of %%@ failed"]; -#endif /* HAVE_REGISTER_PRINTF_FUNCTION */ +#elif defined(HAVE_REGISTER_PRINTF_FUNCTION) + if (register_printf_function ('@', handle_printf_atsign, +#if PRINTF_ATSIGN_VA_LIST + 0)) +#else + arginfo_func)) +#endif + [NSException raise: NSGenericException + format: @"register printf handling of %%@ failed"]; +#endif } } diff --git a/configure b/configure index af861e058..949b573bb 100755 --- a/configure +++ b/configure @@ -16756,8 +16756,102 @@ echo "${ECHO_T}no" >&6; } fi #-------------------------------------------------------------------- -# This function needed by NSString for handling of %@ printf directive. +# This needed by NSString for handling of %@ printf directive. #-------------------------------------------------------------------- + +for ac_func in register_printf_specifier +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 + { echo "$as_me:$LINENO: checking for register_printf_function" >&5 echo $ECHO_N "checking for register_printf_function... $ECHO_C" >&6; } if test "${ac_cv_func_register_printf_function+set}" = set; then diff --git a/configure.ac b/configure.ac index 03dbeba1d..ca5bf1205 100644 --- a/configure.ac +++ b/configure.ac @@ -1098,8 +1098,9 @@ else fi #-------------------------------------------------------------------- -# This function needed by NSString for handling of %@ printf directive. +# This needed by NSString for handling of %@ printf directive. #-------------------------------------------------------------------- +AC_CHECK_FUNCS(register_printf_specifier) AC_CHECK_FUNC(register_printf_function, register_printf=1, register_printf=0) if test $register_printf = 1; then