On MacOS X 10.3 / PowerPC, variables that are implicitly zero-initialized can lead to link errors:
$ gcc -g -O2 -o test-mbsnrtowcs test-mbsnrtowcs.o ../gllib/libgnu.a ld: Undefined symbols: __gl_mbsrtowcs_state This fixes it: 2009-01-25 Bruno Haible <br...@clisp.org> Avoid link errors on MacOS X 10.3. * lib/mbsrtowcs-state.c (_gl_mbsrtowcs_state): Add initializer. * lib/wcsrtombs-state.c (_gl_wcsrtombs_state): Likewise. --- lib/mbsrtowcs-state.c.orig 2009-01-26 03:01:36.000000000 +0100 +++ lib/mbsrtowcs-state.c 2009-01-26 02:58:20.000000000 +0100 @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 Free Software Foundation, Inc. Written by Bruno Haible <br...@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -20,4 +20,4 @@ #include <wchar.h> /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ -mbstate_t _gl_mbsrtowcs_state; +mbstate_t _gl_mbsrtowcs_state = 0; --- lib/wcsrtombs-state.c.orig 2009-01-26 03:01:36.000000000 +0100 +++ lib/wcsrtombs-state.c 2009-01-26 02:59:05.000000000 +0100 @@ -1,5 +1,5 @@ /* Convert wide string to string. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 Free Software Foundation, Inc. Written by Bruno Haible <br...@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -20,4 +20,4 @@ #include <wchar.h> /* Internal state used by the functions wcsrtombs() and wcsnrtombs(). */ -mbstate_t _gl_wcsrtombs_state; +mbstate_t _gl_wcsrtombs_state = 0;