Whamcloud - gitweb
EX-5045 lipe: use LDADD
authorJohn L. Hammond <jhammond@whamcloud.com>
Tue, 24 May 2022 16:10:29 +0000 (11:10 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 9 Jun 2022 20:34:32 +0000 (20:34 +0000)
Use foo_LDADD rather than foo_LDFLAGS to avoid future errors with
strict linkers. Remove AC_SEARCH_LIBS() uses for ext2fs and com_err,
since we already use PKG_CHECK_MODULES() to check for ext2fs
libraries, and not all lipe utilities need -lext2fs.

Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
Change-Id: I1de960fcec5a8770984d9b1437423a854948eb84
Reviewed-on: https://review.whamcloud.com/47443
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Feng, Lei <flei@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lipe/configure.ac
lipe/src/Makefile.am
lipe/src/lipe_scan3/Makefile.am

index 378c614..5841386 100644 (file)
@@ -292,11 +292,6 @@ AS_IF([test "x$enable_zfs" = xyes ], [
        LIBS=$saved_libs
 ])
 
-dnl Pull the needed libraries into LIBS (needed for the AC_LINK_IFELSE below)
-dnl These should never fail if the PKG_CHECK above passes
-AC_SEARCH_LIBS([com_err], [com_err])
-AC_SEARCH_LIBS([ext2fs_open2], [ext2fs])
-
 LIPE_RELEASE="1"
 AC_DEFINE_UNQUOTED(RELEASE, "$LIPE_RELEASE", [release info] )
 AC_DEFINE_UNQUOTED(LIPE_RELEASE, "$LIPE_RELEASE", [release info] )
index 32cb759..2be68ed 100644 (file)
@@ -1,9 +1,16 @@
 AUTOMAKE_OPTIONS = -Wall foreign
 ACLOCAL_AMFLAGS = ${ALOCAL_FLAGS}
 
+liblustre_LIBS = -llustreapi -llnetconfig $(json_c_LIBS) $(yaml_LIBS) -lm
+
+ssh_LIBS = -lssh
+
+if HAVE_SSH_THREADS
+ssh_LIBS += -lssh_threads
+endif
+
 AM_CPPFLAGS = -D_GNU_SOURCE -include config.h
-AM_CFLAGS = -g -Wall -Werror $(json_c_CFLAGS)
-AM_LDFLAGS = -llustreapi -llnetconfig -lyaml -lm -lpthread $(json_c_LIBS)
+AM_CFLAGS = -Wall -Werror -g
 
 bin_PROGRAMS = \
        lpcc_purge
@@ -40,9 +47,13 @@ LIPE_SOURCES = debug.c debug.h \
                policy.c policy.h \
                general_policy.h general_policy.c \
                posix.c posix.h posix_ea.c posix_ea.h
+LIPE_CFLAGS = $(json_c_CFLAGS)
+LIPE_LDADD = $(liblustre_LIBS) -lpthread
 
 if BUILD_SERVER
 ext4_inode2path_SOURCES = debug.c debug.h ext4_inode2path.c
+ext4_inode2path_CFLAGS = $(ext2fs_CFLAGS)
+ext4_inode2path_LDADD = $(ext2fs_LIBS)
 
 LIPE_SOURCES += cmd.c \
                cmd.h \
@@ -53,62 +64,61 @@ LIPE_SOURCES += cmd.c \
                list.h \
                lustre_ea_ldiskfs.c \
                lustre_ea_ldiskfs.h
+LIPE_CFLAGS += $(ext2fs_CFLAGS)
+LIPE_LDADD += $(ext2fs_LIBS)
 endif
 
-LIPE_CFLAGS = -Wall -Werror -g -I/usr/include $(json_c_CFLAGS)
-LIPE_LDFLAGS = $(AM_LDFLAGS)
-
 if ZFS
 LIPE_SOURCES += lipe_zfs.h lipe_zfs.c zfs_read_ldd.c zfs_read_ldd.h
-LIPE_LDFLAGS += -lzfs -lzpool -lnvpair
 LIPE_CFLAGS += $(zfs_CFLAGS)
+LIPE_LDADD += -lzfs -lzpool -lnvpair
 endif
 
 if BUILD_SERVER
 lipe_scan_SOURCES = lipe_scan.c lipe_config.c lipe_config.h lipe_result.c lipe_result.h $(LIPE_SOURCES)
 lipe_scan_CFLAGS = $(LIPE_CFLAGS)
-lipe_scan_LDFLAGS = $(LIPE_LDFLAGS) -lssl -lcrypto -lyaml
+lipe_scan_LDADD = $(LIPE_LDADD) -lssl -lcrypto $(yaml_LIBS)
 
 lipe_scan2_SOURCES = lipe_scan2.c lipe_scan2.h $(LIPE_SOURCES)
 lipe_scan2_CFLAGS = $(LIPE_CFLAGS)
-lipe_scan2_LDFLAGS = $(LIPE_LDFLAGS)
+lipe_scan2_LDADD = $(LIPE_LDADD)
 
 lfill_SOURCES = cmd.c cmd.h debug.c debug.h lfill.c ldiskfs_read_ldd.c \
        ldiskfs_read_ldd.h misc.c misc.h
+lfill_LDADD = $(LIPE_LDADD)
 
 ldumpstripe_SOURCES = ldumpstripe.c lustre_ea.h lustre_ea.c debug.c debug.h
+ldumpstripe_LDADD = $(liblustre_LIBS)
 
 laudit_SOURCES = laudit.c
+laudit_LDADD = $(json_c_LIBS) $(liblustre_LIBS)
 
 laudit_report_SOURCES = laudit-report.c
+laudit_report_LDADD = $(json_c_LIBS) $(liblustre_LIBS)
 
 lipe_ssh_SOURCES = lipe_ssh.c lipe_ssh.h
 
 lamigo_SOURCES = lx_log.h lamigo.c lamigo.h lamigo_alr.c lamigo_hash.c lamigo_hash.h \
                $(LIPE_SOURCES) $(lipe_ssh_SOURCES)
 lamigo_CFLAGS = $(LIPE_CFLAGS)
-lamigo_LDFLAGS = $(LIPE_LDFLAGS) -lssh
-
-if HAVE_SSH_THREADS
-lamigo_LDFLAGS += -lssh_threads
-endif
+lamigo_LDADD = $(LIPE_LDADD) $(json_c_LIBS) $(liblustre_LIBS) $(ssh_LIBS)
 
 lpurge_SOURCES = lx_log.h lpurge.c $(LIPE_SOURCES)
 lpurge_CFLAGS = $(LIPE_CFLAGS)
-lpurge_LDFLAGS = $(LIPE_LDFLAGS)
+lpurge_LDADD = $(LIPE_LDADD)
 
 lipe_expression_test_SOURCES = lipe_expression_test.c $(LIPE_SOURCES)
 lipe_expression_test_CFLAGS = $(LIPE_CFLAGS)
-lipe_expression_test_LDFLAGS = $(LIPE_LDFLAGS)
+lipe_expression_test_LDADD = $(LIPE_LDADD)
 
 endif
 
 generate_definition_SOURCES = generate_definition.c debug.c debug.h \
        general_policy.h
-generate_definition_CFLAGS = -Wall -Werror -Wall -Werror -g
-generate_definition_LDFLAGS =
+# generate_definition_CFLAGS =
+# generate_definition_LDADD =
 
 lpcc_purge_SOURCES = lpcc_purge.c $(LIPE_SOURCES)
 lpcc_purge_CFLAGS = $(LIPE_CFLAGS)
-lpcc_purge_LDFLAGS = $(LIPE_LDFLAGS)
+lpcc_purge_LDADD = $(LIPE_LDADD)
 all: all-am
index 55746e3..340e79e 100644 (file)
@@ -11,8 +11,8 @@ bin_PROGRAMS = lipe_scan3
 
 # Define LUSTRE_UTILS to prevent #error when including lustre_ioctl.h.
 lipe_scan3_CPPFLAGS = -D_GNU_SOURCE -DLUSTRE_UTILS $(GUILE_CFLAGS) -I .. -I ../.. -include config.h
-lipe_scan3_CFLAGS = -Wall -Werror -g $(json_c_CFLAGS) $(GUILE_CFLAGS) -O
-lipe_scan3_LDFLAGS = -pthread $(json_c_LIBS) -llnetconfig -llustreapi $(GUILE_LIBS)
+lipe_scan3_CFLAGS = -Wall -Werror -g -O $(GUILE_CFLAGS) $(ext2fs_CFLAGS) $(json_c_CFLAGS)
+lipe_scan3_LDADD = -llustreapi -llnetconfig $(GUILE_LIBS) $(ext2fs_LIBS) $(json_c_LIBS) -lpthread
 
 lipe_scan3_SOURCES = \
        ../lipe_version.c \