summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-12-18 00:38:37 +0100
committerBruno Haible <bruno@clisp.org>2016-12-18 00:41:01 +0100
commitf9c744dbd9527cc69be7f4f4ff712dd13b0ebedf (patch)
tree2ad9d51e6422f27e29acfcdabb41f3bb5969cb14 /m4
parent15bde6cfc0288f14d7a3140b22c56edbe954a89d (diff)
downloadgnulib-f9c744dbd9527cc69be7f4f4ff712dd13b0ebedf.tar.gz
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.
Diffstat (limited to 'm4')
-rw-r--r--m4/getlogin.m416
1 files changed, 15 insertions, 1 deletions
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])
+])