1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
From 75cba8d5cdb2a0e84c23de26007feac977837a6f Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 18 Jun 2021 17:21:13 +0200
Subject: [PATCH] build-sys: use $LIBS rather than LDFLAGS
Fixes: https://github.com/karelzak/util-linux/pull/1349
Signed-off-by: Karel Zak <kzak@redhat.com>
---
configure.ac | 8 ++++----
m4/ul.m4 | 29 +++++++++++------------------
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/configure.ac b/configure.ac
index 939c6d2d3..234cebc68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -845,7 +845,7 @@ char *c = crypt("abc","pw");
have_libcrypt=no
have_crypt=yes
],[
- UL_SET_FLAGS([], [], [-lcrypt])
+ UL_SET_LIBS([-lcrypt])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_CRYPT_H
#include <crypt.h>
@@ -861,7 +861,7 @@ char *c = crypt("abc","pw");
],[
AC_MSG_WARN([crypt() is not available])
])
- UL_RESTORE_FLAGS
+ UL_RESTORE_LIBS
])
AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
@@ -883,10 +883,10 @@ AS_IF([test "x$with_selinux" = xno], [
UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
AM_CONDITIONAL([HAVE_SELINUX], [true])
- UL_SET_FLAGS([], [], [$SELINUX_LIBS])
+ UL_SET_LIBS([$SELINUX_LIBS])
# This function is missing in old libselinux 1.xx versions
AC_CHECK_FUNCS([security_get_initial_context])
- UL_RESTORE_FLAGS
+ UL_RESTORE_LIBS
])
])
AC_SUBST([SELINUX_LIBS])
diff --git a/m4/ul.m4 b/m4/ul.m4
index 951db7371..724579462 100644
--- a/m4/ul.m4
+++ b/m4/ul.m4
@@ -67,28 +67,21 @@ AC_DEFUN([UL_SET_ARCH], [
])
-dnl UL_SET_FLAGS(CFLAGS, CPPFLAGS, LDFLAGS)
-dnl
-dnl Sets new global CFLAGS, CPPFLAGS and LDFLAG, the original
-dnl setting could be restored by UL_RESTORE_FLAGS()
-dnl
-AC_DEFUN([UL_SET_FLAGS], [
- old_CFLAGS="$CFLAGS"
- old_CPPFLAGS="$CPPFLAGS"
- old_LDFLAGS="$LDFLAGS"
- CFLAGS="$CFLAGS $1"
- CPPFLAGS="$CPPFLAGS $2"
- LDFLAGS="$LDFLAGS $3"
+dnl UL_SET_LIBS(LIBS)
+dnl
+dnl Sets new global LIBS, the original setting could be restored by UL_RESTORE_LIBS()
+dnl
+AC_DEFUN([UL_SET_LIBS], [
+ old_LIBS="$LIBS"
+ LIBS="$LIBS $1"
])
-dnl UL_RESTORE_FLAGS()
+dnl UL_RESTORE_LIBS()
dnl
-dnl Restores CFLAGS, CPPFLAGS and LDFLAG previously saved by UL_SET_FLAGS()
+dnl Restores LIBS previously saved by UL_SET_LIBS()
dnl
-AC_DEFUN([UL_RESTORE_FLAGS], [
- CFLAGS="$old_CFLAGS"
- CPPFLAGS="$old_CPPFLAGS"
- LDFLAGS="$old_LDFLAGS"
+AC_DEFUN([UL_RESTORE_LIBS], [
+ LIBS="$old_LIBS"
])
|