mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Ticket #2409: fix of GModule detection and usage.
Don't mix GLib and GModule compiler and linker options. Use gmodule-no-export if present to avoid use -Wl,--export-dynamic option with some linkers. If gmodule-no-export is not available, use generic gmodule. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4c356e3dd3
commit
62c05d62f3
30
configure.ac
30
configure.ac
@ -59,13 +59,6 @@ if test x"$glib_found" = xno; then
|
||||
AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0], [gmodule_found=yes])
|
||||
GLIB_LIBDIR="`$PKG_CONFIG --variable=libdir glib-2.0`"
|
||||
|
||||
if test "x$gmodule_found" = "xyes" ; then
|
||||
dnl Check if the gmodule functionality supported on this system.
|
||||
AC_G_MODULE_SUPPORTED
|
||||
fi
|
||||
|
||||
AC_HEADER_MAJOR
|
||||
AC_C_CONST
|
||||
@ -225,27 +218,10 @@ AC_FUNC_STRCOLL
|
||||
dnl
|
||||
dnl X11 support.
|
||||
dnl Used to read keyboard modifiers when running under X11.
|
||||
dnl
|
||||
|
||||
AC_PATH_XTRA
|
||||
if test "x$no_x" = xyes; then
|
||||
textmode_x11_support="no"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
if test "x$mc_cv_g_module_supported" = "xyes" ; then
|
||||
dnl Replace the contents of GLIB_CFLAGS and GLIB_LIBS with those of
|
||||
dnl GMODULE_CFLAGS and GMODULE_LIBS, only if X is available and gmodule
|
||||
dnl functionality is supported on the system. This way, mc will be
|
||||
dnl linked against the gmodule library only when it's really required.
|
||||
GLIB_CFLAGS="$GMODULE_CFLAGS"
|
||||
GLIB_LIBS="$GMODULE_LIBS"
|
||||
else
|
||||
MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
|
||||
fi
|
||||
AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
|
||||
[Define to enable getting events from X Window System])
|
||||
textmode_x11_support="yes"
|
||||
fi
|
||||
dnl
|
||||
dnl Check if the gmodule functionality supported on this system.
|
||||
AC_G_MODULE_SUPPORTED
|
||||
|
||||
dnl
|
||||
dnl Try to find static libraries for glib and gmodule.
|
||||
|
@ -22,6 +22,13 @@ TTY_SRC = \
|
||||
|
||||
libmctty_la_SOURCES = $(TTY_SRC) $(TTY_SCREEN_SRC)
|
||||
|
||||
libmctty_la_CFLAGS = -I$(top_srcdir) \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
|
||||
libmctty_la_CFLAGS = -I$(top_srcdir)
|
||||
|
||||
if HAVE_GMODULE
|
||||
libmctty_la_CFLAGS += $(GMODULE_CFLAGS)
|
||||
else
|
||||
libmctty_la_CFLAGS += $(GLIB_CFLAGS)
|
||||
|
||||
endif
|
||||
libmctty_la_CFLAGS += -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
|
||||
|
||||
|
@ -4,22 +4,42 @@ dnl on this system. We need to know that at the compile time to
|
||||
dnl decide whether to link with X11.
|
||||
dnl
|
||||
AC_DEFUN([AC_G_MODULE_SUPPORTED], [
|
||||
AC_CACHE_CHECK([if gmodule functionality is supported],
|
||||
[mc_cv_g_module_supported],
|
||||
[
|
||||
mc_cv_g_module_supported=no;
|
||||
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.8], [found_gmodule=yes], [:])
|
||||
if test x"$found_gmodule" = "xyes"; then
|
||||
mc_cv_g_module_supported=yes
|
||||
fi
|
||||
])
|
||||
|
||||
if test x"$mc_cv_g_module_supported" = "xyes"; then
|
||||
if test x`$PKG_CONFIG --variable=gmodule_supported gmodule-2.0` = xtrue; then
|
||||
GLIB_LIBS="$GMODULE_LIBS $GLIB_LIBS"
|
||||
CFLAGS="$GMODULE_CFLAGS $CFLAGS"
|
||||
AC_DEFINE([HAVE_GMODULE], [1],
|
||||
[Defined if gmodule functionality is supported])
|
||||
g_module_supported=""
|
||||
if test x"$no_x" = xyes; then
|
||||
textmode_x11_support="no"
|
||||
else
|
||||
found_gmodule=no
|
||||
PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.8], [found_gmodule=yes], [:])
|
||||
if test x"$found_gmodule" = xyes; then
|
||||
g_module_supported="gmodule-no-export-2.0"
|
||||
else
|
||||
dnl try fallback to the generic gmodule
|
||||
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.8], [found_gmodule=yes], [:])
|
||||
if test x"$found_gmodule" = xyes; then
|
||||
g_module_supported="gmodule-2.0"
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
case x"$g_module_supported" in
|
||||
xgmodule-no-export-2.0|xgmodule-2.0)
|
||||
if test x`$PKG_CONFIG --variable=gmodule_supported "$g_module_supported"` = xtrue; then
|
||||
AC_DEFINE([HAVE_GMODULE], [1], [Defined if gmodule functionality is supported])
|
||||
else
|
||||
g_module_supported=""
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
|
||||
g_module_supported=""
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE([HAVE_TEXTMODE_X11_SUPPORT], [1],
|
||||
[Define to enable getting events from X Window System])
|
||||
textmode_x11_support="yes"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_GMODULE], [test x"$g_module_supported" != x])
|
||||
])
|
||||
|
@ -21,7 +21,7 @@ endif
|
||||
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
|
||||
bin_PROGRAMS = mc
|
||||
|
||||
@ -37,15 +37,23 @@ mc_LDADD = \
|
||||
viewer/libmcviewer.la \
|
||||
filemanager/libmcfilemanager.la \
|
||||
$(DIFFLIB) $(EDITLIB) \
|
||||
../lib/libmc.la \
|
||||
$(MCLIBS) $(SLANGLIB) $(GLIB_LIBS) \
|
||||
$(PCRE_LIBS) $(LIBICONV) $(INTLLIBS)
|
||||
../lib/libmc.la
|
||||
|
||||
if ENABLE_VFS_SMB
|
||||
# this is a hack for linking with own samba library in simple way
|
||||
mc_LDADD += ../lib/vfs/mc-vfs/samba/libsamba.a
|
||||
endif
|
||||
|
||||
mc_LDADD += $(MCLIBS) $(SLANGLIB)
|
||||
|
||||
if HAVE_GMODULE
|
||||
mc_LDADD += $(GMODULE_LIBS)
|
||||
else
|
||||
mc_LDADD += $(GLIB_LIBS)
|
||||
endif
|
||||
|
||||
mc_LDADD += $(PCRE_LIBS) $(LIBICONV) $(INTLLIBS)
|
||||
|
||||
SRC_mc_conssaver = \
|
||||
cons.handler.c consaver/cons.saver.h
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user