On HP-UX 11.11, I'm seeing this error: cc -Ae -O -DHAVE_CONFIG_H -I. -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -g -c -o test-getlogin_r.o test-getlogin_r.c cc: "test-getlogin_r.c", line 24: error 1588: "getlogin_r" undefined. cc: "test-getlogin_r.c", line 24: error 1521: Incorrect initialization. *** Error exit code 1
It's because <unistd.h> declares getlogin_r only if _REENTRANT is defined. This fixes it: 2010-12-20 Bruno Haible <br...@clisp.org> getlogin_r: Add missing declaration on HP-UX 11. * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test whether getlogin_r is declared also when it exists as a function. --- m4/getlogin_r.m4.orig Mon Dec 20 12:20:03 2010 +++ m4/getlogin_r.m4 Mon Dec 20 11:58:14 2010 @@ -1,4 +1,4 @@ -#serial 7 +#serial 8 # Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. # @@ -20,14 +20,15 @@ dnl getlogin_r(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_DECLS_ONCE([getlogin_r]) + if test $ac_cv_have_decl_getlogin_r = no; then + HAVE_DECL_GETLOGIN_R=0 + fi + AC_CHECK_FUNCS_ONCE([getlogin_r]) if test $ac_cv_func_getlogin_r = no; then AC_LIBOBJ([getlogin_r]) gl_PREREQ_GETLOGIN_R - AC_CHECK_DECLS_ONCE([getlogin_r]) - if test $ac_cv_have_decl_getlogin_r = no; then - HAVE_DECL_GETLOGIN_R=0 - fi fi ])