On MSVC 9, a testdir for the 'getcwd' module yields these link errors: libgnu.a(getcwd.obj) : error LNK2019: reference to unresolved symbol "_rewinddir" in function "_rpl_getcwd". libgnu.a(getcwd.obj) : error LNK2019: reference to unresolved symbol "_readdir" in function "_rpl_getcwd". libgnu.a(getcwd.obj) : error LNK2019: reference to unresolved symbol "_closedir" in function "_rpl_getcwd". test-binary-io.exe : fatal error LNK1120: 3 unresolved external symbols. make[4]: *** [test-binary-io.exe] error 2
These two patches fix it. 2011-11-27 Bruno Haible <[email protected]> Don't set REPLACE_FOO to 1 if HAVE_FOO is 0. * m4/opendir.m4 (gl_FUNC_OPENDIR): Don't set REPLACE_OPENDIR to 1 if HAVE_OPENDIR is 0. * m4/closedir.m4 (gl_FUNC_CLOSEDIR): Don't set REPLACE_CLOSEDIR to 1 if HAVE_CLOSEDIR is 0. * m4/dup2.m4 (gl_FUNC_DUP2): Don't set REPLACE_DUP2 to 1 if HAVE_DUP2 is 0. * m4/dup3.m4 (gl_FUNC_DUP3): Update comments. --- m4/closedir.m4.orig Mon Nov 28 00:38:30 2011 +++ m4/closedir.m4 Mon Nov 28 00:27:59 2011 @@ -1,4 +1,4 @@ -# closedir.m4 serial 1 +# closedir.m4 serial 2 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,9 @@ m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then - REPLACE_CLOSEDIR=1 + if test $HAVE_CLOSEDIR = 1; then + REPLACE_CLOSEDIR=1 + fi fi ]) ]) --- m4/dup2.m4.orig Mon Nov 28 00:38:30 2011 +++ m4/dup2.m4 Mon Nov 28 00:29:20 2011 @@ -1,4 +1,4 @@ -#serial 16 +#serial 17 dnl Copyright (C) 2002, 2005, 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -67,7 +67,9 @@ m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then - REPLACE_DUP2=1 + if test $HAVE_DUP2 = 1; then + REPLACE_DUP2=1 + fi fi ]) ]) --- m4/dup3.m4.orig Mon Nov 28 00:38:30 2011 +++ m4/dup3.m4 Mon Nov 28 00:29:47 2011 @@ -1,4 +1,4 @@ -# dup3.m4 serial 3 +# dup3.m4 serial 4 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,7 +22,9 @@ dnl m4_ifdef([gl_FUNC_FCHDIR], [ dnl gl_TEST_FCHDIR dnl if test $HAVE_FCHDIR = 0; then -dnl REPLACE_DUP3=1 +dnl if test $HAVE_DUP3 = 1; then +dnl REPLACE_DUP3=1 +dnl fi dnl fi dnl ]) ]) --- m4/opendir.m4.orig Mon Nov 28 00:38:30 2011 +++ m4/opendir.m4 Mon Nov 28 00:31:45 2011 @@ -1,4 +1,4 @@ -# opendir.m4 serial 1 +# opendir.m4 serial 2 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,9 @@ m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then - REPLACE_OPENDIR=1 + if test $HAVE_OPENDIR = 1; then + REPLACE_OPENDIR=1 + fi fi ]) ]) 2011-11-27 Bruno Haible <[email protected]> getcwd: Fix link error on MSVC 9. * modules/getcwd (Depends-on): Add readdir, rewinddir. --- modules/getcwd.orig Mon Nov 28 00:38:30 2011 +++ modules/getcwd Mon Nov 28 00:21:08 2011 @@ -21,6 +21,8 @@ fstat [test $REPLACE_GETCWD = 1] fstatat [test $REPLACE_GETCWD = 1] opendir [test $REPLACE_GETCWD = 1] +readdir [test $REPLACE_GETCWD = 1] +rewinddir [test $REPLACE_GETCWD = 1] closedir [test $REPLACE_GETCWD = 1] stdbool [test $REPLACE_GETCWD = 1] malloc-posix [test $REPLACE_GETCWD = 1] -- In memoriam George Moscone <http://en.wikipedia.org/wiki/George_Moscone>
