]> Savannah Git Hosting - gnulib.git/commitdiff
getlogin, getlogin_r: Fix link errors on MSVC.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 23:38:37 +0000 (00:38 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 23:41:01 +0000 (00:41 +0100)
* 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.

ChangeLog
NEWS
m4/getlogin.m4
modules/getlogin
modules/getlogin-tests
modules/getlogin_r
modules/getlogin_r-tests

index e8c3f5c5af2fceaa5891619d69c7cfe31003172b..1ecdb7ff51eb488031c82ccd2f1f6a38c9e9a82b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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.
diff --git a/NEWS b/NEWS
index fbbf6f2ce79ac86163adff42c313ccbf4e49e7f0..3db60850552e68af8b2b9a96adad362b630a043b 100644 (file)
--- 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.
index a03193b06a94dcddec75ed419bd64d3a1276a991..a9dc4d3eb0ba14487b56771c7a1c180cb2e82b58 100644 (file)
@@ -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])
+])
index 379052af72c84545b9751897a76aa4bc7d367bad..1348319b70aaea302c1314d555f3a34b287f21a0 100644 (file)
@@ -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+
 
index 6facd60fb03857ca08e35474389afdf1ebed2e36..c8cdb05eb0fd15e920247df09a1ee9c0ef440a42 100644 (file)
@@ -11,3 +11,4 @@ AC_CHECK_FUNCS_ONCE([ttyname])
 Makefile.am:
 TESTS += test-getlogin
 check_PROGRAMS += test-getlogin
+test_getlogin_LDADD = $(LDADD) $(LIB_GETLOGIN)
index 5406d9472da874fe9eb8f55693004995cd5ca81e..169cb441a2f126f40d5e965fd81cd5df40922c13 100644 (file)
@@ -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+
 
index eda7b45324d7c1f68213b1b45cbf2c7c70aee428..868b1b6f73be10c207756f743a7912f3dd74eb29 100644 (file)
@@ -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)