From: Theodore Ts'o Date: Mon, 11 Feb 2019 02:44:05 +0000 (-0500) Subject: Check for the newer blkid functions without adding blkid to @LIBS@ X-Git-Tag: v1.44.6~5 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7154d974b24c8833b8f349f47075bfac6366c360;p=tools%2Fe2fsprogs.git Check for the newer blkid functions without adding blkid to @LIBS@ If we are using the system-provided blkid, check for the newer blkid functions without adding -lblkid to @LIBS@. This prevents programs (like badblocks) which don't use the blkid library getting linked against it. Addresses-Debian-Bug: #919958 Signed-off-by: Theodore Ts'o --- diff --git a/configure b/configure index 1ac0654..62e1ccb 100755 --- a/configure +++ b/configure @@ -13060,12 +13060,13 @@ _ACEOF fi if test -n "$BLKID_CMT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing blkid_probe_all" >&5 -$as_echo_n "checking for library containing blkid_probe_all... " >&6; } -if ${ac_cv_search_blkid_probe_all+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_probe_get_topology in -lblkid" >&5 +$as_echo_n "checking for blkid_probe_get_topology in -lblkid... " >&6; } +if ${ac_cv_lib_blkid_blkid_probe_get_topology+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS + ac_check_lib_save_LIBS=$LIBS +LIBS="-lblkid $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -13075,44 +13076,69 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char blkid_probe_all (); +char blkid_probe_get_topology (); int main () { -return blkid_probe_all (); +return blkid_probe_get_topology (); ; return 0; } _ACEOF -for ac_lib in '' blkid; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_blkid_probe_all=$ac_res +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_blkid_blkid_probe_get_topology=yes +else + ac_cv_lib_blkid_blkid_probe_get_topology=no fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_blkid_probe_all+:} false; then : - break + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -done -if ${ac_cv_search_blkid_probe_all+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blkid_blkid_probe_get_topology" >&5 +$as_echo "$ac_cv_lib_blkid_blkid_probe_get_topology" >&6; } +if test "x$ac_cv_lib_blkid_blkid_probe_get_topology" = xyes; then : + $as_echo "#define HAVE_BLKID_PROBE_GET_TOPOLOGY 1" >>confdefs.h + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_probe_enable_partitions in -lblkid" >&5 +$as_echo_n "checking for blkid_probe_enable_partitions in -lblkid... " >&6; } +if ${ac_cv_lib_blkid_blkid_probe_enable_partitions+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lblkid $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char blkid_probe_enable_partitions (); +int +main () +{ +return blkid_probe_enable_partitions (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_blkid_blkid_probe_enable_partitions=yes else - ac_cv_search_blkid_probe_all=no + ac_cv_lib_blkid_blkid_probe_enable_partitions=no fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_blkid_probe_all" >&5 -$as_echo "$ac_cv_search_blkid_probe_all" >&6; } -ac_res=$ac_cv_search_blkid_probe_all -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blkid_blkid_probe_enable_partitions" >&5 +$as_echo "$ac_cv_lib_blkid_blkid_probe_enable_partitions" >&6; } +if test "x$ac_cv_lib_blkid_blkid_probe_enable_partitions" = xyes; then : + $as_echo "#define HAVE_BLKID_PROBE_ENABLE_PARTITIONS 1" >>confdefs.h fi @@ -13120,7 +13146,7 @@ fi if test -n "$DLOPEN_LIB" ; then ac_cv_func_dlopen=yes fi -for ac_func in __secure_getenv add_key backtrace blkid_probe_get_topology blkid_probe_enable_partitions chflags dlopen fadvise64 fallocate fallocate64 fchown fcntl fdatasync fstat64 fsync ftruncate64 futimes getcwd getdtablesize gethostname getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc +for ac_func in __secure_getenv add_key backtrace chflags dlopen fadvise64 fallocate fallocate64 fchown fcntl fdatasync fstat64 fsync ftruncate64 futimes getcwd getdtablesize gethostname getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 51a446d..0de9057 100644 --- a/configure.ac +++ b/configure.ac @@ -1113,11 +1113,14 @@ AC_CHECK_MEMBER(struct sockaddr.sa_len, [#include #include ]) dnl -dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using -dnl the system-provided blkid library +dnl If we are using the system-provided blkid library, check for +dnl the functions added after migrating that library to util-linux dnl if test -n "$BLKID_CMT"; then - AC_SEARCH_LIBS([blkid_probe_all], [blkid]) + AC_CHECK_LIB(blkid, blkid_probe_get_topology, + AC_DEFINE(HAVE_BLKID_PROBE_GET_TOPOLOGY, 1)) + AC_CHECK_LIB(blkid, blkid_probe_enable_partitions, + AC_DEFINE(HAVE_BLKID_PROBE_ENABLE_PARTITIONS, 1)) fi dnl if test -n "$DLOPEN_LIB" ; then @@ -1127,8 +1130,6 @@ AC_CHECK_FUNCS(m4_flatten([ __secure_getenv add_key backtrace - blkid_probe_get_topology - blkid_probe_enable_partitions chflags dlopen fadvise64