Pass link libraries via LIBS variable into Makefiles (#734718)
Currently -lparted is passed to the linker by being hard coded in the gpartedbin_LDFLAGS variable in src/Makefile.am and -lparted-fs-resize by conditionally being appended to the gpartedbin_LDFLAGS. Add an Autoconf AC_CHECK_LIB check for the parted library using it's default action-if-found to extend LIBS. Update the existing AC_CHECK_LIB check for the parted-fs-resize library so that the overridden action-if-found also extends LIBS with -lparted-fs-resize. These libraries are then assigned via the LIBS variable in the generated Makefiles. This matches how the other libraries, dl and uuid, were found in the configure script and passed to the Makefiles. Bug #734718 - Update Autoconf version specific libparted checks and defines to feature specific ones
This commit is contained in:
parent
bb17f44e99
commit
3030118caf
16
configure.ac
16
configure.ac
|
@ -38,8 +38,9 @@ IT_PROG_INTLTOOL([0.35.5])
|
|||
dnl======================
|
||||
dnl checks for libs
|
||||
dnl======================
|
||||
AC_CHECK_LIB([uuid], [uuid_generate], [], AC_MSG_ERROR([*** uuid library (libuuid) not found]))
|
||||
AC_CHECK_LIB([dl], [dlopen], [], AC_MSG_ERROR([*** dl library (libdl) not found]))
|
||||
AC_CHECK_LIB([uuid], [uuid_generate], [], AC_MSG_ERROR([*** libuuid not found.]))
|
||||
AC_CHECK_LIB([dl], [dlopen], [], AC_MSG_ERROR([*** libdl not found.]))
|
||||
AC_CHECK_LIB([parted], [ped_device_read], [], AC_MSG_ERROR([*** libparted not found.]))
|
||||
|
||||
|
||||
dnl Check for minimum required libparted version
|
||||
|
@ -47,8 +48,6 @@ LIBPARTED_REQUIRED_VERSION='1.7.1'
|
|||
AC_MSG_CHECKING([for libparted >= $LIBPARTED_REQUIRED_VERSION])
|
||||
LIBPARTED_REQUIRED_INT=`echo "$LIBPARTED_REQUIRED_VERSION" |
|
||||
$AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
|
||||
LIBS_save="$LIBS"
|
||||
LIBS="-lparted -luuid -ldl"
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE(
|
||||
[[
|
||||
|
@ -78,7 +77,6 @@ int main()
|
|||
],
|
||||
[AC_MSG_ERROR([*** Error querying libparted version. Check config.log for details.])]
|
||||
)
|
||||
LIBS="$LIBS_save"
|
||||
|
||||
|
||||
dnl Check for libparted >= 2.2 for improved informing the kernel to
|
||||
|
@ -128,15 +126,13 @@ AS_IF(
|
|||
[test "x$have_old_lp_fs_resize_api" != xyes],
|
||||
[AC_CHECK_LIB(
|
||||
[parted-fs-resize], [ped_file_system_resize],
|
||||
[have_new_lp_fs_resize_lib=yes]
|
||||
[have_new_lp_fs_resize_lib=yes
|
||||
LIBS="-lparted-fs-resize $LIBS"
|
||||
]
|
||||
)]
|
||||
)
|
||||
|
||||
|
||||
dnl Check for availability of libparted fs resize library
|
||||
AM_CONDITIONAL([USE_LIBPARTED_FS_RESIZE_LIBRARY], [ test ${have_new_lp_fs_resize_lib} = yes])
|
||||
|
||||
|
||||
dnl Check if have libparted fs resize capability
|
||||
if test [ ${have_old_lp_fs_resize_api} = yes -o ${have_new_lp_fs_resize_lib} = yes ]; then
|
||||
AC_DEFINE([HAVE_LIBPARTED_FS_RESIZE], [1], [Define to 1 if have libparted fs resize capability])
|
||||
|
|
|
@ -68,11 +68,5 @@ gpartedbin_SOURCES = \
|
|||
ufs.cc \
|
||||
xfs.cc
|
||||
|
||||
gpartedbin_LDFLAGS = -lparted
|
||||
|
||||
if USE_LIBPARTED_FS_RESIZE_LIBRARY
|
||||
gpartedbin_LDFLAGS += -lparted-fs-resize
|
||||
endif
|
||||
|
||||
gpartedbin_LDADD = $(GTHREAD_LIBS) $(GTKMM_LIBS)
|
||||
|
||||
|
|
Loading…
Reference in New Issue