summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--NEWS3
-rw-r--r--m4/getlogin.m416
-rw-r--r--modules/getlogin4
-rw-r--r--modules/getlogin-tests1
-rw-r--r--modules/getlogin_r5
-rw-r--r--modules/getlogin_r-tests1
7 files changed, 42 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e8c3f5c5af..1ecdb7ff51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2016-12-17 Bruno Haible <bruno@clisp.org>
+ getlogin, getlogin_r: Fix link errors on MSVC.
+ * m4/getlogin.m4 (gl_LIB_GETLOGIN): New macro.
+ * modules/getlogin (configure.ac): Require gl_LIB_GETLOGIN.
+ (Link): New section.
+ * modules/getlogin_r (Files): Add m4/getlogin.m4.
+ (configure.ac): Require gl_LIB_GETLOGIN.
+ (Link): New section.
+ * NEWS: Mention the new link requirements.
+ * modules/getlogin-tests (test_getlogin_LDADD): New variable.
+ * modules/getlogin_r-tests (test_getlogin_r_LDADD): New variable.
+
+2016-12-17 Bruno Haible <bruno@clisp.org>
+
Un-deprecate the 'progname' module.
* NEWS: Describe the appropriate use-cases of 'progname' versus
'getprogname'. Based on discussion summary at
diff --git a/NEWS b/NEWS
index fbbf6f2ce7..3db6085055 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,9 @@ User visible incompatible changes
Date Modules Changes
+2016-12-17 getlogin The link requirements of these modules are changed
+ getlogin_r from empty to $(LIB_GETLOGIN).
+
2016-12-13 dfa Remove DFA_CASE_FOLD flag. Now based on RE_ICASE.
2016-11-17 unistr/u32-strmblen The function u32_strmblen can now return -1.
diff --git a/m4/getlogin.m4 b/m4/getlogin.m4
index a03193b06a..a9dc4d3eb0 100644
--- a/m4/getlogin.m4
+++ b/m4/getlogin.m4
@@ -1,4 +1,4 @@
-# getlogin.m4 serial 4
+# getlogin.m4 serial 5
dnl Copyright (C) 2010-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -16,3 +16,17 @@ AC_DEFUN([gl_FUNC_GETLOGIN],
HAVE_GETLOGIN=0
fi
])
+
+dnl Determines the library needed by the implementation of the
+dnl getlogin and getlogin_r functions.
+AC_DEFUN([gl_LIB_GETLOGIN],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ case $host_os in
+ mingw*)
+ LIB_GETLOGIN='-ladvapi32' ;;
+ *)
+ LIB_GETLOGIN= ;;
+ esac
+ AC_SUBST([LIB_GETLOGIN])
+])
diff --git a/modules/getlogin b/modules/getlogin
index 379052af72..1348319b70 100644
--- a/modules/getlogin
+++ b/modules/getlogin
@@ -14,12 +14,16 @@ if test $HAVE_GETLOGIN = 0; then
AC_LIBOBJ([getlogin])
fi
gl_UNISTD_MODULE_INDICATOR([getlogin])
+AC_REQUIRE([gl_LIB_GETLOGIN])
Makefile.am:
Include:
<unistd.h>
+Link:
+$(LIB_GETLOGIN)
+
License:
LGPLv2+
diff --git a/modules/getlogin-tests b/modules/getlogin-tests
index 6facd60fb0..c8cdb05eb0 100644
--- a/modules/getlogin-tests
+++ b/modules/getlogin-tests
@@ -11,3 +11,4 @@ AC_CHECK_FUNCS_ONCE([ttyname])
Makefile.am:
TESTS += test-getlogin
check_PROGRAMS += test-getlogin
+test_getlogin_LDADD = $(LDADD) $(LIB_GETLOGIN)
diff --git a/modules/getlogin_r b/modules/getlogin_r
index 5406d9472d..169cb441a2 100644
--- a/modules/getlogin_r
+++ b/modules/getlogin_r
@@ -4,6 +4,7 @@ getlogin_r() function: Get user name to a buffer allocated by the caller.
Files:
lib/getlogin_r.c
m4/getlogin_r.m4
+m4/getlogin.m4
Depends-on:
unistd
@@ -17,12 +18,16 @@ if test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1; then
gl_PREREQ_GETLOGIN_R
fi
gl_UNISTD_MODULE_INDICATOR([getlogin_r])
+AC_REQUIRE([gl_LIB_GETLOGIN])
Makefile.am:
Include:
<unistd.h>
+Link:
+$(LIB_GETLOGIN)
+
License:
LGPLv2+
diff --git a/modules/getlogin_r-tests b/modules/getlogin_r-tests
index eda7b45324..868b1b6f73 100644
--- a/modules/getlogin_r-tests
+++ b/modules/getlogin_r-tests
@@ -11,3 +11,4 @@ AC_CHECK_FUNCS_ONCE([ttyname])
Makefile.am:
TESTS += test-getlogin_r
check_PROGRAMS += test-getlogin_r
+test_getlogin_r_LDADD = $(LDADD) $(LIB_GETLOGIN)