misc: if dlopen() is available, use it to load the libmagic library
PATCH 1/1 misc: if dlopen() is available, use it to load the libmagic library
This prevents the libmagic library from being a hard dependency; if it's not there, we can simply do without it.
Signed-off-by Theodore Ts'o <[email protected]>
Cc Darrick J. Wong <[email protected]>
--- configure | 3 +++ configure.in | 3 +++ misc/plausible.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 55 insertions(+), 7 deletions(-)
configure +3 -0
@@ -13187,6 +13187,9 @@ done fi +if test "$ac_cv_lib_dl_dlopen" = yes ; then + MAGIC_LIB=$DLOPEN_LIB +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for optreset" >&5 $as_echo_n "checking for optreset... " >&6; }
configure.in +3 -0
@@ -1157,6 +1157,9 @@ dnl See if libmagic exists dnl AC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic AC_CHECK_HEADERS([magic.h])]) +if test "$ac_cv_lib_dl_dlopen" = yes ; then + MAGIC_LIB=$DLOPEN_LIB +fi AC_SUBST(MAGIC_LIB) dnl dnl See if optreset exists
misc/plausible.c +49 -7
75 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 1/1 misc: fix build on absence of magic.h
If magic.h is not present, there will be unresolved references to the magic_t type in plausible.c. Fix that by moving the protecting #ifdef directive.
Signed-off-by Artemiy Volkov <[email protected]>
--- misc/plausible.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
misc/plausible.c +1 -1
@@ -36,12 +36,12 @@#include "nls-enable.h" #include "blkid/blkid.h" +#ifdef HAVE_MAGIC_H static magic_t (*dl_magic_open)(int );static const char *(*dl_magic_file)(magic_t ,const char *);static int (*dl_magic_load)(magic_t ,const char *);static void (*dl_magic_close)(magic_t ); -#ifdef HAVE_MAGIC_H #ifdef HAVE_DLOPEN #include <dlfcn.h>
Signature · 1 line
1.9.1
Theodore Ts'o
AppliedRe: [PATCH] misc: fix build on absence of magic.h
Quoted 4 lines · Artemiy Volkov
If
magic.his not present, there will be unresolved references to themagic_ttype inplausible.c. Fix that by moving the protecting #ifdef directive.Signed-off-by Artemiy Volkov <[email protected]>
Applied, thanks.
- Ted